Submission #1115338
Source Code Expand
// In the name of God #include <iostream> #include <algorithm> #include <fstream> #include <vector> #include <deque> #include <assert.h> #include <queue> #include <stack> #include <set> #include <map> #include <stdio.h> #include <string.h> #include <utility> #include <math.h> #include <bitset> #include <iomanip> using namespace std; const int N = (int) 1e6 + 6, mod = (int) 0; int res[N]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; for (int a = 0; a < 2; ++a) { for (int b = 0; b < 2; ++b) { res[0] = a; res[1] = b; for (int j = 2; j < n; ++j) { res[j] = ((s[j - 1] != 'o') ^ res[j - 1]) ^ res[j - 2]; } int flag = 1; for (int x = 0; x < n; ++x) { int pr = (x - 1 + n) % n, nx = (x + 1 + n) % n; if (((s[x] == 'o') ^ res[x]) != (res[pr] == res[nx])) flag = 0; } if (flag) { for (int j = 0; j < n; ++j) cout << (res[j] == 0? 'S': 'W'); cout << endl; return 0; } } } cout << -1 << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | Reyna |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1300 Byte |
Status | AC |
Exec Time | 8 ms |
Memory | 976 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 | 768 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 | 6 ms | 896 KB |
06.txt | AC | 4 ms | 896 KB |
07.txt | AC | 2 ms | 384 KB |
08.txt | AC | 2 ms | 384 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 2 ms | 384 KB |
11.txt | AC | 8 ms | 976 KB |
12.txt | AC | 8 ms | 976 KB |
13.txt | AC | 7 ms | 976 KB |