Submission #1131205


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 342 Byte
Status RE
Exec Time 65 ms
Memory 6268 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 × 18
WA × 2
RE × 23
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 3836 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 1788 KB
2_00.txt RE 65 ms 6268 KB
2_01.txt RE 65 ms 6268 KB
2_02.txt RE 65 ms 6268 KB
2_03.txt RE 65 ms 6268 KB
2_04.txt RE 65 ms 6268 KB
2_05.txt RE 65 ms 6268 KB
2_06.txt RE 65 ms 6268 KB
2_07.txt RE 48 ms 4860 KB
2_08.txt RE 63 ms 6140 KB
2_09.txt RE 61 ms 5884 KB
2_10.txt RE 61 ms 5884 KB
2_11.txt RE 64 ms 6140 KB
2_12.txt RE 61 ms 5884 KB
2_13.txt RE 55 ms 5500 KB
2_14.txt RE 58 ms 5756 KB
2_15.txt RE 54 ms 5372 KB
2_16.txt RE 56 ms 5500 KB
2_17.txt RE 52 ms 5116 KB
2_18.txt RE 45 ms 4604 KB
2_19.txt RE 61 ms 5884 KB
2_20.txt RE 45 ms 4732 KB
2_21.txt RE 43 ms 4476 KB
2_22.txt RE 64 ms 6140 KB