Submission #1482039
Source Code Expand
#include<string> #include<deque> #include<queue> #include<vector> #include<algorithm> #include<iostream> #include<set> #include<cmath> #include<tuple> #include<chrono> #include<functional> #include<iterator> #include<random> #include<unordered_set> #include<map> using namespace std; typedef long long int llint; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define fir first #define sec second #define res resize #define ins insert #define era erase const int mod=1000000007; const llint big=1e18+10; const long double pai=3.141592653589793238462643383279502884197; const long double eps=1e-9; template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}} template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}} int gcd(int a,int b){if(a%b==0){return b;}else return gcd(b,a%b);}//a>b class in_t{public: int a;in_t(){cin>>a;} operator int() {return a;} }; class lin_t{public: llint a;lin_t(){cin>>a;} operator llint() {return a;} }; class ld_t{public: long double a;ld_t(){cin>>a;} operator long double() {return a;} }; int main(void){ in_t n; string str;cin>>str; str.pub(str[0]); //o->SSS,WSW string ans; ans.res(n+2); for(int ba=0;ba<4;ba++){ if(ba==0){ans[0]='S',ans[1]='S';} if(ba==1){ans[0]='S',ans[1]='W';} if(ba==2){ans[0]='W',ans[1]='S';} if(ba==3){ans[0]='W',ans[1]='W';} for(int i=1;i<=n;i++){ int bi=0; if(ans[i-1]=='W'){bi++;} if(ans[i]=='W'){bi++;} if(str[i]=='x'){bi++;} if(bi%2==0){ans[i+1]='S';} else{ans[i+1]='W';} } if(!(ans[0]==ans[n]&&ans[1]==ans[n+1])){continue;} ans.pob();ans.pob(); cout<<ans<<endl;return 0; } cout<<"-1"<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | WA_TLE |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1783 Byte |
Status | AC |
Exec Time | 8 ms |
Memory | 512 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt |
All | 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
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 | 5 ms | 512 KB |
02.txt | AC | 3 ms | 384 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 7 ms | 512 KB |
06.txt | AC | 5 ms | 512 KB |
07.txt | AC | 2 ms | 256 KB |
08.txt | AC | 2 ms | 256 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 3 ms | 256 KB |
11.txt | AC | 8 ms | 512 KB |
12.txt | AC | 8 ms | 512 KB |
13.txt | AC | 7 ms | 512 KB |