Submission #1116834


Source Code Expand

N = int(raw_input())
s = raw_input()

D = ["SS", "SW", "WS", "WW"]
A = "SW"

s += s[0]
for d in D:
    a = d
    for i in range(1, N+1):
        k = 0
        if a[i] == "W":
            k += 1
        if s[i] == "x":
            k += 1
        if a[i-1] == "W":
            k += 1
        a += A[k % 2]
    if a[:2] == a[-2:]:
        print a[:-2]
        exit()
print -1

Submission Info

Submission Time
Task D - Menagerie
User zepp
Language Python (2.7.6)
Score 500
Code Size 395 Byte
Status AC
Exec Time 245 ms
Memory 6132 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 16
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 11 ms 2568 KB
00_example_02.txt AC 11 ms 2568 KB
00_example_03.txt AC 11 ms 2568 KB
01.txt AC 122 ms 4880 KB
02.txt AC 38 ms 4100 KB
03.txt AC 16 ms 2692 KB
04.txt AC 11 ms 2568 KB
05.txt AC 165 ms 5696 KB
06.txt AC 65 ms 5636 KB
07.txt AC 37 ms 3076 KB
08.txt AC 30 ms 3204 KB
09.txt AC 13 ms 2692 KB
10.txt AC 55 ms 3308 KB
11.txt AC 239 ms 6132 KB
12.txt AC 245 ms 6132 KB
13.txt AC 190 ms 6132 KB