Submission #3219051
Source Code Expand
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; string s; cin >> s; vector<string> check = {"SS", "SW", "WS", "WW"}; string ans; for (string lst : check){ ans = lst; for (int i=2; i<N; i++){ if (ans[i-1] == 'S'){ if (s[i-1] == 'o'){ if (ans[i-2] == 'S') ans += 'S'; else ans += 'W'; } else { if (ans[i-2] == 'S') ans += 'W'; else ans += 'S'; } } else { if (s[i-1] == 'o'){ if (ans[i-2] == 'S') ans += 'W'; else ans += 'S'; } else { if (ans[i-2] == 'S') ans += 'S'; else ans += 'W'; } } } bool flag = false; if (ans[N-1] == 'S'){ if (s[N-1] == 'o'){ if (ans[0] == ans[N-2]) flag = true; } else { if (ans[0] != ans[N-2]) flag = true; } } else { if (s[N-1] == 'o'){ if (ans[0] != ans[N-2]) flag = true; } else { if (ans[0] == ans[N-2]) flag = true; } } if (flag){ cout << ans << endl; return 0; } } cout << -1 << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | integralyamada |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1220 Byte |
Status | WA |
Exec Time | 7 ms |
Memory | 768 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 | 1 ms | 256 KB |
01.txt | WA | 5 ms | 512 KB |
02.txt | AC | 3 ms | 512 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | WA | 6 ms | 740 KB |
06.txt | AC | 5 ms | 640 KB |
07.txt | WA | 2 ms | 256 KB |
08.txt | AC | 2 ms | 384 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | WA | 2 ms | 384 KB |
11.txt | WA | 6 ms | 768 KB |
12.txt | WA | 6 ms | 768 KB |
13.txt | WA | 7 ms | 728 KB |