Submission #2402281


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] && pat[1] ^ pat[N - 1] ^ s[0] ^ pat[0] == 0
        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 500
Code Size 420 Byte
Status AC
Exec Time 167 ms
Memory 16324 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 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 7 ms 1788 KB
00_example_02.txt AC 7 ms 1788 KB
00_example_03.txt AC 7 ms 1788 KB
01.txt AC 97 ms 11132 KB
02.txt AC 58 ms 7292 KB
03.txt AC 11 ms 1916 KB
04.txt AC 7 ms 1788 KB
05.txt AC 136 ms 14276 KB
06.txt AC 102 ms 12868 KB
07.txt AC 30 ms 3836 KB
08.txt AC 28 ms 3836 KB
09.txt AC 12 ms 2172 KB
10.txt AC 35 ms 4092 KB
11.txt AC 167 ms 16324 KB
12.txt AC 167 ms 16324 KB
13.txt AC 149 ms 15556 KB