Submission #1128433
Source Code Expand
n = input() s = raw_input() def calc(x, y): S = [0]*n S[0] = x; S[1] = y for i in xrange(2, n): if (S[i-1] and s[i-1] == 'o') or (not S[i-1] and s[i-1] == 'x'): S[i] = S[i-2] else: S[i] = S[i-2] ^ 1 if (S[n-1] and s[n-1] == 'o') or (not S[n-1] and s[n-1] == 'x'): if S[n-2] != S[0]: return '' else: if S[n-2] == S[0]: return '' if (S[0] and s[0] == 'o') or (not S[0] and s[0] == 'x'): if S[n-1] != S[1]: return '' else: if S[n-1] == S[1]: return '' return "".join(map("WS".__getitem__, S)) for i in xrange(4): res = calc(i & 1, (i>>1)&1) if res: print res break else: print "-1"
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | yaketake08 |
Language | Python (2.7.6) |
Score | 500 |
Code Size | 791 Byte |
Status | AC |
Exec Time | 89 ms |
Memory | 4484 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 | 10 ms | 2696 KB |
00_example_02.txt | AC | 10 ms | 2696 KB |
00_example_03.txt | AC | 10 ms | 2696 KB |
01.txt | AC | 54 ms | 3856 KB |
02.txt | AC | 22 ms | 3460 KB |
03.txt | AC | 12 ms | 2696 KB |
04.txt | AC | 10 ms | 2696 KB |
05.txt | AC | 71 ms | 4288 KB |
06.txt | AC | 89 ms | 4292 KB |
07.txt | AC | 21 ms | 2948 KB |
08.txt | AC | 18 ms | 2944 KB |
09.txt | AC | 14 ms | 2696 KB |
10.txt | AC | 26 ms | 2820 KB |
11.txt | AC | 37 ms | 4484 KB |
12.txt | AC | 37 ms | 4484 KB |
13.txt | AC | 78 ms | 4468 KB |