Submission #1853974
Source Code Expand
#include <iostream> #include <cstdio> using namespace std; int n, num[100005], a[100005]; string ta; int main() { int i, j, k, t1, t2; cin >> n; cin >> ta; for (i = 0; i < n; i++) { if (ta[i] == 'o') a[i] = 0; else a[i] = 1; } a[n] = a[0]; for (i = 0; i< 2; i++) { for (j= 0; j< 2; j++) { num[0] = i; num[1] = j; for (k = 1; k < n + 1; k++) { num[k+1]=((num[k - 1] ^ num[k]) ^ a[k]); } if (num[n] == num[0] && num[n+1] == num[1]) { for (k = 0; k < n; k++) { if (num[k] == 0) printf("S"); else printf("W"); } return 0; } } } cout << -1 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | sean617 |
Language | C++14 (GCC 5.4.1) |
Score | 500 |
Code Size | 816 Byte |
Status | AC |
Exec Time | 7 ms |
Memory | 1408 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 | 4 ms | 896 KB |
02.txt | AC | 3 ms | 768 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 6 ms | 1280 KB |
06.txt | AC | 6 ms | 1280 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 | 512 KB |
11.txt | AC | 6 ms | 1408 KB |
12.txt | AC | 7 ms | 1308 KB |
13.txt | AC | 6 ms | 1308 KB |