Submission #3417984
Source Code Expand
N = int(input()) s = input() s += s[:2] rec = [[""] * (N + 2) for i in range(4)] rec[0][0] = "S" rec[0][1] = "S" rec[1][0] = "S" rec[1][1] = "W" rec[2][0] = "W" rec[2][1] = "S" rec[3][0] = "W" rec[3][1] = "W" k = -1 for i in range(4): for j in range(1, N + 1): if s[j] == "o": if rec[i][j] == "S": rec[i][j + 1] = rec[i][j - 1] else: if rec[i][j - 1] == "S": rec[i][j + 1] = "W" else: rec[i][j + 1] = "S" else: if rec[i][j] == "S": if rec[i][j - 1] == "S": rec[i][j + 1] = "W" else: rec[i][j + 1] = "S" else: rec[i][j + 1] = rec[i][j - 1] if rec[0][0] == rec[0][N] and rec[0][1] == rec[0][N + 1]: k = 0 elif rec[1][0] == rec[1][N] and rec[1][1] == rec[1][N + 1]: k = 1 elif rec[2][0] == rec[2][N] and rec[2][1] == rec[2][N + 1]: k = 2 elif rec[3][0] == rec[3][N] and rec[3][1] == rec[3][N + 1]: k = 3 if k == -1: print(-1) else: print("".join(rec[k][:N]))
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | ys5678910 |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 1171 Byte |
Status | AC |
Exec Time | 211 ms |
Memory | 7284 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 | 3188 KB |
00_example_02.txt | AC | 17 ms | 3188 KB |
00_example_03.txt | AC | 17 ms | 3188 KB |
01.txt | AC | 134 ms | 5876 KB |
02.txt | AC | 109 ms | 5108 KB |
03.txt | AC | 22 ms | 3188 KB |
04.txt | AC | 17 ms | 3188 KB |
05.txt | AC | 186 ms | 6900 KB |
06.txt | AC | 188 ms | 6772 KB |
07.txt | AC | 47 ms | 3828 KB |
08.txt | AC | 47 ms | 3828 KB |
09.txt | AC | 24 ms | 3316 KB |
10.txt | AC | 52 ms | 3828 KB |
11.txt | AC | 201 ms | 7284 KB |
12.txt | AC | 211 ms | 7284 KB |
13.txt | AC | 207 ms | 7284 KB |