Submission #1116802
Source Code Expand
#include <bits/stdc++.h> using namespace std; bool b[100000]; int main() { int n; string s; cin >> n >> s; for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++){ bool fl = 0; b[0] = i; b[1] = j; for (int it = 1; it < n - 1; it++){ if ((b[it] && s[it] == 'o') || (!b[it] && s[it] == 'x')){ b[it + 1] = b[it - 1]; } else{ b[it + 1] = !b[it - 1]; } } if ((b[n - 1] && s[n - 1] == 'o') || (!b[n - 1] && s[n - 1] == 'x')){ if (b[0] != b[n - 2]) fl = 1; } else{ if (b[0] == b[n - 2]) fl = 1; } for (int it = 0; it < n; it++){ if (b[it] && s[it] == 'o'){ if (b[(it - 1 + n) % n] != b[(it + 1) % n]) fl = 1; } if (b[it] && s[it] == 'x'){ if (b[(it - 1 + n) % n] == b[(it + 1) % n]) fl = 1; } if (!b[it] && s[it] == 'o'){ if (b[(it - 1 + n) % n] == b[(it + 1) % n]) fl = 1; } if (!b[it] && s[it] == 'x'){ if (b[(it - 1 + n) % n] != b[(it + 1) % n]) fl = 1; } } if (!fl){ for (int it = 0; it < n; it++) cout << (b[it] ? 'S' : 'W'); return 0; } } cout << -1 << '\n'; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | IsmagilS |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1596 Byte |
Status | AC |
Exec Time | 13 ms |
Memory | 640 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 | 7 ms | 512 KB |
02.txt | AC | 5 ms | 384 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 10 ms | 640 KB |
06.txt | AC | 13 ms | 640 KB |
07.txt | AC | 3 ms | 256 KB |
08.txt | AC | 3 ms | 384 KB |
09.txt | AC | 2 ms | 256 KB |
10.txt | AC | 3 ms | 256 KB |
11.txt | AC | 9 ms | 640 KB |
12.txt | AC | 9 ms | 640 KB |
13.txt | AC | 11 ms | 640 KB |