AtCoder Beginner Contest 055

Submission #1591600

Source codeソースコード

    #include<cstdio>
    #include<cstdlib>
    #include<cstring>
    #include<cmath>
    #include<ctime>
    #include<cctype>
    #include<climits>
    #include<iostream>
    #include<string>
    #include<vector>
    #include<map>
    #include<list>
    #include<queue>
    #include<deque>
    #include<algorithm>
    #include<numeric>
    #include<utility>
    #include<complex>
    #include<memory>
    #include<functional>
    #include<set>
     
    using namespace std;
     
    #define ALL(g) (g).begin(),(g).end()
    #define REP(i, x, n) for(int i = x; i < n; i++)
    #define rep(i,n) REP(i,0,n)
    #define F(i,j,k) fill(i[0],i[0]+j*j,k)
    #define P(p) cout<<(p)<<endl;
    #define EXIST(s,e) ((s).find(e)!=(s).end())
    #define INF 1<<25
    #define pb push_back
     
    typedef vector<int> vi;
    typedef vector<long long> vl;
    typedef vector<double> vd;
    typedef pair<int,int> pii;
    typedef pair<long,long> pll;
    typedef long long ll;
    int N;
    string s;
    char decision[4][100001];
    //連続する二匹が確定すれば全部確定する。4通りを試す
    bool check(int num,int now){
    		if(now==N+1){
/*		if((s[now-1]=='o'&&decision[num][now-1]=='S')||(s[now-1]=='x'&&decision[num][now-1]=='W')){
				if(decision[num][N-2]!=decision[num][0])return false;
			}
			else 
				if(decision[num][N-2]==decision[num][0])return false;
*/
    			if(decision[num][now-1]==decision[num][0]){
    				rep(i,N)
    					cout<<decision[num][i];
    				cout<<endl;
    					return true;
    			}
    			else
    	//			cout<<"no"<<endl;
     
    			return false;
    		}
    		if((s[now-1]=='o'&&decision[num][now-1]=='S')||(s[now-1]=='x'&&decision[num][now-1]=='W')){
    			decision[num][now]=decision[num][now-2];
    		//	cout<<num<<" "<<now<<" "<<decision[num][now]<<endl;
    			}				
    		else{
    			if(decision[num][now-2]=='W')
    				decision[num][now]='S';
    			else
    				decision[num][now]='W';
     
    	//		cout<<num<<" "<<now<<" "<<decision[num][now]<<endl;
    		}
    	 return	check(num,now+1);
     
    }
     
    int main(){
    	cin>>N>>s;
    	decision[0][0]='S';
    	decision[0][1]='S';
     
    	decision[1][0]='W';
    	decision[1][1]='S';
     
    	decision[2][0]='S';
    	decision[2][1]='W';
     
    	decision[3][0]='W';
    	decision[3][1]='W';
    	if(check(0,2))return 0;
    	if(check(1,2))return 0;
    	if(check(2,2))return 0;
    	if(check(3,2))return 0;
     
    	cout<<"-1"<<endl;
    	return 0;
    }

Submission

Task問題 D - Menagerie
User nameユーザ名 Zvezda
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 2597 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - 00_example_01.txt,00_example_02.txt,00_example_03.txt
All 0 / 500 00_example_01.txt,00_example_02.txt,00_example_03.txt,01.txt,02.txt,03.txt,04.txt,05.txt,06.txt,07.txt,08.txt,09.txt,10.txt,11.txt,12.txt,13.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_example_01.txt AC 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 1 ms 256 KB
01.txt AC 9 ms 4608 KB
02.txt AC 6 ms 3328 KB
03.txt AC 1 ms 384 KB
04.txt AC 1 ms 256 KB
05.txt AC 12 ms 6400 KB
06.txt AC 11 ms 6272 KB
07.txt WA
08.txt WA
09.txt AC 2 ms 512 KB
10.txt WA
11.txt WA
12.txt WA
13.txt AC 13 ms 7040 KB