Submission #2831466
Source Code Expand
n = int(input()) S = input() def rev(anim): if anim == 'S': return 'W' else: return 'S' def check(comb, ans): if comb[1] == 'S': if ans == 'o': return comb[0] == comb[2] else: return comb[0] != comb[2] else: if ans == 'o': return comb[0] != comb[2] else: return comb[0] == comb[2] import sys for T in ('SS', 'SW', 'WS', 'WW'): for i in range(2, n): ans = S[i-1] anim = T[i-1] prev = T[i-2] if ans == 'o': if anim == 'S': T += prev else: T += rev(prev) else: if anim == 'S': T += rev(prev) else: T += prev comb1 = T[n-2]+T[n-1]+T[0] ans1 = S[n-1] comb2 = T[n-1]+T[0]+T[1] ans2 = S[0] if check(comb1, ans1) and check(comb2, ans2): print(T) sys.exit(0) print(-1)
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | yamadah |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 1012 Byte |
Status | AC |
Exec Time | 259 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 | 18 ms | 3064 KB |
00_example_02.txt | AC | 18 ms | 3064 KB |
00_example_03.txt | AC | 18 ms | 3064 KB |
01.txt | AC | 134 ms | 3316 KB |
02.txt | AC | 45 ms | 3316 KB |
03.txt | AC | 23 ms | 3064 KB |
04.txt | AC | 18 ms | 3064 KB |
05.txt | AC | 176 ms | 3444 KB |
06.txt | AC | 72 ms | 3444 KB |
07.txt | AC | 45 ms | 3188 KB |
08.txt | AC | 38 ms | 3064 KB |
09.txt | AC | 20 ms | 3064 KB |
10.txt | AC | 63 ms | 3064 KB |
11.txt | AC | 258 ms | 3444 KB |
12.txt | AC | 259 ms | 3444 KB |
13.txt | AC | 193 ms | 3444 KB |