Submission #1115944
Source Code Expand
#include <iostream> #include <string> using namespace std; int N; string str; const int NMAX = 100000 + 10 + 5; bool type[NMAX]; int main() { cin >> N; cin >> str; str = " " + str; str += str[1]; for (int i = 0; i < 2; ++ i) for (int j = 0; j < 2; ++ j) { type[1] = i; type[2] = j; for (int k = 2; k <= N + 1; ++ k) if (type[k] == 0) { if (str[k] == 'o') type[k + 1] = type[k - 1]; else type[k + 1] = type[k - 1] ^ 1; } else { if (str[k] == 'o') type[k + 1] = type[k - 1] ^ 1; else type[k + 1] = type[k - 1]; } if (type[1] == type[N + 1] && type[2] == type[N + 2]) { for (int k = 1; k <= N; ++ k) if (type[k] == 0) cout << 'S'; else cout << 'W'; cout << '\n'; return 0; } } cout << "-1\n"; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | Andrei1998 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 1241 Byte |
Status | AC |
Exec Time | 10 ms |
Memory | 636 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 | 6 ms | 512 KB |
02.txt | AC | 4 ms | 384 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 9 ms | 636 KB |
06.txt | AC | 8 ms | 636 KB |
07.txt | AC | 2 ms | 256 KB |
08.txt | AC | 2 ms | 384 KB |
09.txt | AC | 1 ms | 256 KB |
10.txt | AC | 2 ms | 256 KB |
11.txt | AC | 10 ms | 636 KB |
12.txt | AC | 10 ms | 636 KB |
13.txt | AC | 9 ms | 636 KB |