Submission #1966074
Source Code Expand
import sys N = int(input()) s = input() def verify(s, tmpAns): global N for i in range(N): if (s[i] == 'o' and tmpAns[i] == 'S') \ or (s[i] == 'x' and tmpAns[i] == 'W'): if tmpAns[(i+1)%N] != tmpAns[(i-1+N)%N]: return False elif (s[i] == 'x' and tmpAns[i] == 'S') \ or (s[i] == 'o' and tmpAns[i] == 'W'): if tmpAns[(i+1)%N] == tmpAns[(i-1+N)%N]: return False return True for i in range(4): a = 'S' if i & 1 else 'W' b = 'S' if i & 2 else 'W' tmpAns = a + b for j in range(N-2): c = s[j+1] a, b = tmpAns[j], tmpAns[j+1] # print('a: %s, b: %s, c: %s' % (a, b, c)) if c == 'o' and b == 'W': tmpAns += 'W' if a == 'S' else 'S' elif c == 'o' and b == 'S': tmpAns += 'S' if a == 'S' else 'W' elif c == 'x' and b == 'W': tmpAns += 'S' if a == 'S' else 'W' elif c == 'x' and b == 'S': tmpAns += 'W' if a == 'S' else 'S' # print(tmpAns) if verify(s, tmpAns): print(tmpAns) sys.exit(0) print(-1)
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | kotarou |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 1216 Byte |
Status | AC |
Exec Time | 336 ms |
Memory | 3444 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 | 21 ms | 3444 KB |
00_example_02.txt | AC | 17 ms | 3064 KB |
00_example_03.txt | AC | 17 ms | 3064 KB |
01.txt | AC | 179 ms | 3444 KB |
02.txt | AC | 71 ms | 3316 KB |
03.txt | AC | 23 ms | 3064 KB |
04.txt | AC | 17 ms | 3064 KB |
05.txt | AC | 241 ms | 3444 KB |
06.txt | AC | 336 ms | 3444 KB |
07.txt | AC | 64 ms | 3188 KB |
08.txt | AC | 56 ms | 3188 KB |
09.txt | AC | 31 ms | 3064 KB |
10.txt | AC | 69 ms | 3064 KB |
11.txt | AC | 131 ms | 3444 KB |
12.txt | AC | 136 ms | 3444 KB |
13.txt | AC | 277 ms | 3444 KB |