Submission #1773893
Source Code Expand
#include<iostream> #include<cstdio> #include<vector> #include<map> #include<string> #include<sstream> #include<cmath> #include<climits> #include<algorithm> #include<bitset> #include<set> #include<stack> #include<queue> #include<iomanip> #include<memory.h> #include<complex> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef tuple<int,int> tii; #define rep(i,n) for(ll i=0;i<(n);i++) #define pb push_back #define mt make_tuple #define ALL(a) (a).begin(),(a).end() #define FST first #define SEC second const int INF = (INT_MAX/2); const ll LLINF = (LLONG_MAX/2); const double eps = 1e-8; const double PI = M_PI; #define DEB cerr<<"!"<<endl #define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl #define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" ")) #define DIV int(1e9+7) inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;} inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;} /* Coding Space*/ int n; string str; void dfs(string s){ int ss = s.size(); char c = s[ss-1]; char cb = s[ss-2]; if(ss == n){ if(s[ss-2] != s[0]){ if((str[ss-1] == 'o' && s[ss-1] == 'W') || (str[ss-1] == 'x' && s[ss-1] == 'S')) {cout << s << endl; exit(0);} else return; }else{ if((str[ss-1] == 'o' && s[ss-1] == 'S') || (str[ss-1] == 'x' && s[ss-1] == 'W')) {cout << s << endl; exit(0);} else return; } } if(c == 'S' && cb == 'W') (str[ss-1] == 'o')?dfs(s+"W"):dfs(s+"S"); if(c == 'S' && cb == 'S') (str[ss-1] == 'o')?dfs(s+"S"):dfs(s+"W"); if(c=='W' && cb == 'S') (str[ss-1] == 'o')?dfs(s+"W"):dfs(s+"S"); if(c == 'W' && cb == 'W') (str[ss-1] == 'o')?dfs(s+"S"):dfs(s+"W"); return; } int main(){ cin >> n >> str; dfs("SS"); dfs("SW"); dfs("WS"); dfs("WW"); cout << -1 << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | cashisu1 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 2004 Byte |
Status | RE |
Exec Time | 3517 ms |
Memory | 1281664 KB |
Judge Result
Set Name | Sample | All | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 3 ms | 384 KB |
01.txt | TLE | 2234 ms | -1819136 KB |
02.txt | MLE | 697 ms | 1281664 KB |
03.txt | AC | 20 ms | 6748 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | RE | 1809 ms | -788120 KB |
06.txt | RE | 2022 ms | -788072 KB |
07.txt | WA | 109 ms | 179956 KB |
08.txt | AC | 256 ms | 205352 KB |
09.txt | AC | 13 ms | 19840 KB |
10.txt | MLE | 149 ms | 266752 KB |
11.txt | RE | 2004 ms | -788024 KB |
12.txt | TLE | 2507 ms | -787420 KB |
13.txt | TLE | 3517 ms | -787420 KB |