Submission #2402228


Source Code Expand

N = gets.to_i
# 異なる場合0
s = gets.chomp.split('').map{|c| c == 'o' ? 0 : 1}

# 羊が0
pat01 = [[0, 0], [0, 1], [1, 0], [1, 1]]

pat01.each do |pat|
    (2..N).each do |i|
        pat[i] = pat[i - 2] ^ pat[i - 1] ^ s[i - 1]
    end
    if pat[0] == pat[N]
        puts pat[0...N].map{|bit| bit == 0 ? 'S' :  'W'}.join
        exit
    end
end

puts -1

Submission Info

Submission Time
Task D - Menagerie
User betrue12
Language Ruby (2.3.3)
Score 0
Code Size 376 Byte
Status WA
Exec Time 128 ms
Memory 14788 KB

Compile Error

./Main.rb:18: warning: ambiguous first argument; put parentheses or a space even after `-' operator

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 9
WA × 7
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 7 ms 1788 KB
00_example_02.txt AC 7 ms 1788 KB
00_example_03.txt AC 7 ms 1788 KB
01.txt WA 85 ms 10620 KB
02.txt AC 58 ms 7236 KB
03.txt AC 11 ms 1916 KB
04.txt AC 7 ms 1788 KB
05.txt WA 118 ms 13636 KB
06.txt AC 101 ms 12868 KB
07.txt WA 24 ms 3580 KB
08.txt AC 28 ms 3836 KB
09.txt AC 12 ms 2172 KB
10.txt WA 28 ms 4220 KB
11.txt WA 110 ms 14020 KB
12.txt WA 111 ms 14020 KB
13.txt WA 128 ms 14788 KB