Submission #1117577
Source Code Expand
n = gets.to_i $xs = gets.chomp.split '' def check(v, i) sheep = v[i] prev = i - 1 prev = v.length - 1 if i == 0 tugi = i + 1 tugi = 0 if tugi == v.size if sheep if $xs[i] == 'o' return false if v[prev] != v[tugi] else return false if v[prev] == v[tugi] end else if $xs[i] == 'o' return false if v[prev] == v[tugi] else return false if v[prev] != v[tugi] end end return true end [true, false].repeated_permutation(3) { |a, b, c| v = [a, b, c] next if !check(v, 1) for i in 2..(n-2) do if v[i] if $xs[i] == 'o' v << v[i-1] else v << !v[i-1] end else if $xs[i] == 'o' v << !v[i-1] else v << v[i-1] end end end if check(v, 0) and check(v, v.size - 1) puts v.map {|b| b ? "S" : "W" }.join '' exit end } p -1
Submission Info
Submission Time | |
---|---|
Task | D - Menagerie |
User | cympfh |
Language | Ruby (2.3.3) |
Score | 500 |
Code Size | 958 Byte |
Status | AC |
Exec Time | 179 ms |
Memory | 13076 KB |
Compile Error
./Main.rb:50: warning: shadowing outer local variable - b ./Main.rb:55: 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 |
|
|
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 | 99 ms | 10248 KB |
02.txt | AC | 55 ms | 6908 KB |
03.txt | AC | 11 ms | 2172 KB |
04.txt | AC | 7 ms | 1788 KB |
05.txt | AC | 143 ms | 11948 KB |
06.txt | AC | 97 ms | 12028 KB |
07.txt | AC | 31 ms | 3340 KB |
08.txt | AC | 28 ms | 4092 KB |
09.txt | AC | 11 ms | 2172 KB |
10.txt | AC | 36 ms | 4324 KB |
11.txt | AC | 179 ms | 13060 KB |
12.txt | AC | 178 ms | 13004 KB |
13.txt | AC | 156 ms | 13076 KB |