Submission #1131208


Source Code Expand

#!/usr/bin/ruby
n=gets.to_i
s=n.times.map{gets.chomp.bytes}
g=n.times.map{[35]*n}
d={s=>0}
q=[s]
#raise if n>3

while !q.empty?
	c=q.shift
	if c==g
		p d[c]
		exit
	end
	n.times{|i|
		color=c.transpose[i]
		n.times{|j|
			c0=c.dup
			c0[j]=color
			if !d.has_key?(c0)
				d[c0]=d[c]+1
				q<<c0
			end
		}
	}
end
p -1

Submission Info

Submission Time
Task B - Row to Column
User leafmoon
Language Ruby (2.3.3)
Score 0
Code Size 343 Byte
Status WA
Exec Time 2104 ms
Memory 12308 KB

Compile Error

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

Judge Result

Set Name Sample Subtask All
Score / Max Score 0 / 0 0 / 300 0 / 1000
Status
AC × 5
AC × 18
WA × 2
AC × 19
WA × 2
TLE × 22
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt
Subtask 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 2_00.txt, 2_01.txt, 2_02.txt, 2_03.txt, 2_04.txt, 2_05.txt, 2_06.txt, 2_07.txt, 2_08.txt, 2_09.txt, 2_10.txt, 2_11.txt, 2_12.txt, 2_13.txt, 2_14.txt, 2_15.txt, 2_16.txt, 2_17.txt, 2_18.txt, 2_19.txt, 2_20.txt, 2_21.txt, 2_22.txt
Case Name Status Exec Time Memory
0_00.txt AC 7 ms 1788 KB
0_01.txt AC 7 ms 1788 KB
0_02.txt AC 7 ms 1788 KB
0_03.txt AC 8 ms 1788 KB
0_04.txt AC 21 ms 1788 KB
1_00.txt AC 7 ms 1788 KB
1_01.txt AC 7 ms 1788 KB
1_02.txt AC 19 ms 1788 KB
1_03.txt AC 25 ms 1788 KB
1_04.txt AC 24 ms 1788 KB
1_05.txt AC 21 ms 1788 KB
1_06.txt WA 26 ms 1916 KB
1_07.txt WA 23 ms 1788 KB
1_08.txt AC 9 ms 1788 KB
1_09.txt AC 21 ms 1788 KB
1_10.txt AC 25 ms 1788 KB
1_11.txt AC 11 ms 1788 KB
1_12.txt AC 7 ms 1788 KB
1_13.txt AC 8 ms 1788 KB
1_14.txt AC 25 ms 1916 KB
2_00.txt TLE 2104 ms 8316 KB
2_01.txt AC 115 ms 6268 KB
2_02.txt TLE 2103 ms 12308 KB
2_03.txt TLE 2104 ms 8316 KB
2_04.txt TLE 2104 ms 8188 KB
2_05.txt TLE 2104 ms 8316 KB
2_06.txt TLE 2104 ms 8316 KB
2_07.txt TLE 2104 ms 8444 KB
2_08.txt TLE 2104 ms 8060 KB
2_09.txt TLE 2104 ms 7804 KB
2_10.txt TLE 2104 ms 7804 KB
2_11.txt TLE 2103 ms 10236 KB
2_12.txt TLE 2104 ms 7804 KB
2_13.txt TLE 2104 ms 7164 KB
2_14.txt TLE 2104 ms 7548 KB
2_15.txt TLE 2103 ms 7420 KB
2_16.txt TLE 2104 ms 7292 KB
2_17.txt TLE 2104 ms 6780 KB
2_18.txt TLE 2104 ms 6012 KB
2_19.txt TLE 2104 ms 7804 KB
2_20.txt TLE 2103 ms 8084 KB
2_21.txt TLE 2104 ms 5756 KB
2_22.txt TLE 2104 ms 8060 KB