Submission #2307911
Source Code Expand
import sys N=int(input()) S=input() flgT=["SSS","SWW","WWS","WSW"] flgF=["SSW","WSS","SWS","WWW"] if S[0]=='o': for i in range(4): str=flgT[i] for j in range(1,N): if (S[j]=="o" and str[-1]=="S") or (S[j]=="x" and str[-1]=="W"): str=str+str[-2] else: if str[-2]=="W": str=str+"S" else: str=str+"W" if str[-2]==str[0] and str[-1]==str[1]: str=str[1:-1] print(str) sys.exit() else: for i in range(4): str=flgF[i] for j in range(1,N): if (S[j]=="o" and str[-1]=="S") or (S[j]=="x" and str[-1]=="W"): str=str+str[-2] else: if str[-2]=="W": str=str+"S" else: str=str+"W" if str[-2]==str[0] and str[-1]==str[1]: str=str[1:-1] print(str) sys.exit() print(-1)
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | kobaya0514 |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 870 Byte |
Status | AC |
Exec Time | 139 ms |
Memory | 3572 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 | 17 ms | 3064 KB |
00_example_02.txt | AC | 17 ms | 3064 KB |
00_example_03.txt | AC | 17 ms | 3064 KB |
01.txt | AC | 106 ms | 3444 KB |
02.txt | AC | 36 ms | 3316 KB |
03.txt | AC | 21 ms | 3064 KB |
04.txt | AC | 17 ms | 3064 KB |
05.txt | AC | 127 ms | 3444 KB |
06.txt | AC | 55 ms | 3572 KB |
07.txt | AC | 37 ms | 3188 KB |
08.txt | AC | 24 ms | 3188 KB |
09.txt | AC | 20 ms | 3064 KB |
10.txt | AC | 49 ms | 3188 KB |
11.txt | AC | 100 ms | 3572 KB |
12.txt | AC | 100 ms | 3444 KB |
13.txt | AC | 139 ms | 3444 KB |