Submission #2214654
Source Code Expand
#include <bits/stdc++.h> #define int long long #define range(i, a, b) for(int i = (a); i < (b); i++) #define rep(i, a) range(i, 0, a) using namespace std; const int INF = sizeof(int) == sizeof(long long) ? LLONG_MAX : INT_MAX; const int MOD = 1000000007; const long double EPS = 1e-8; signed main() { int n; string s; cin >> n >> s; rep (i, 2) { string ans = i ? "S" : "W"; string tmp = ans; rep (j, 2) { ans = tmp; ans += j ? "S" : "W"; /* */ range (k, 1, s.size()) { if (s[k] == 'o') { if (ans[k] == 'S') ans += ans[k - 1] == 'S' ? "S" : "W"; else ans += ans[k - 1] == 'S' ? "W" : "S"; } else { if (ans[k] == 'S') ans += ans[k - 1] == 'S' ? "W" : "S"; else ans += ans[k - 1] == 'S' ? "S" : "W"; } } if (s[0] == 'o') { if (ans[1] == 'S') { if (ans[0] == 'S') ans.insert(ans.begin(), 'S'); else ans.insert(ans.begin(), 'W'); } else { if (ans[0] == 'S') ans.insert(ans.begin(), 'W'); else ans.insert(ans.begin(), 'S'); } } else { if (ans[1] == 'S') { if (ans[0] == 'S') ans.insert(ans.begin(), 'W'); else ans.insert(ans.begin(), 'S'); } else { if (ans[0] == 'S') ans.insert(ans.begin(), 'S'); else ans.insert(ans.begin(), 'W'); } } if (ans[0] == ans[ans.size() - 2] && ans[1] == ans[ans.size() - 1]) { ans.pop_back(); ans.erase(ans.begin()); cout << ans << endl; return 0; } } } cout << -1 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | Masumi |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1572 Byte |
Status | AC |
Exec Time | 10 ms |
Memory | 768 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 | 512 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 7 ms | 740 KB |
06.txt | AC | 10 ms | 684 KB |
07.txt | AC | 2 ms | 256 KB |
08.txt | AC | 3 ms | 384 KB |
09.txt | AC | 2 ms | 256 KB |
10.txt | AC | 3 ms | 384 KB |
11.txt | AC | 6 ms | 768 KB |
12.txt | AC | 6 ms | 768 KB |
13.txt | AC | 8 ms | 728 KB |