Submission #51311820


Source Code Expand

(N,H,W),*AB = $<.map{|ln| ln.split.map(&:to_i) }
HW = [*0...H].product([*0...W])
F = lambda{|g,((a,b),*abs)|
	i,j = HW.find{|i,j| ! g[i][j] }
	next true unless i
	next unless a
	g2 = g.map(&:dup)
	next a.times.all?{|di|
		b.times.all?{|dj|
			g[i+di][j+dj] = true if i+di<H && j+dj<W && ! g[i+di][j+dj]
		}
	}&&F[g,abs]||b.times.all?{|di|
		a.times.all?{|dj|
			g2[i+di][j+dj] = true if i+di<H && j+dj<W && ! g2[i+di][j+dj]
		}
	}&&F[g2,abs]
}
puts(AB.permutation.any?{|abs|
	F[Array.new(H){[nil]*W},abs]
}?'Yes':'No')

Submission Info

Submission Time
Task D - Tiling
User ds14050
Language Ruby (ruby 3.2.2)
Score 0
Code Size 539 Byte
Status TLE
Exec Time 2025 ms
Memory 17740 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 450
Status
AC × 4
AC × 81
TLE × 1
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt, example_03.txt
All example_00.txt, example_01.txt, example_02.txt, example_03.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, hand_17.txt, hand_18.txt, hand_19.txt, hand_20.txt, hand_21.txt, hand_22.txt, hand_23.txt, hand_24.txt, hand_25.txt, hand_26.txt, hand_27.txt, hand_28.txt, hand_29.txt, hand_30.txt, hand_31.txt, hand_32.txt, hand_33.txt, hand_34.txt, hand_35.txt, random2_00.txt, random2_01.txt, random2_02.txt, random2_03.txt, random2_04.txt, random2_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, random_35.txt
Case Name Status Exec Time Memory
example_00.txt AC 45 ms 17460 KiB
example_01.txt AC 42 ms 17220 KiB
example_02.txt AC 42 ms 17216 KiB
example_03.txt AC 45 ms 17560 KiB
hand_00.txt AC 52 ms 17480 KiB
hand_01.txt AC 42 ms 17524 KiB
hand_02.txt AC 59 ms 17580 KiB
hand_03.txt AC 42 ms 17200 KiB
hand_04.txt AC 41 ms 17060 KiB
hand_05.txt TLE 2025 ms 17416 KiB
hand_06.txt AC 43 ms 17448 KiB
hand_07.txt AC 125 ms 17488 KiB
hand_08.txt AC 49 ms 17332 KiB
hand_09.txt AC 42 ms 17460 KiB
hand_10.txt AC 46 ms 17500 KiB
hand_11.txt AC 67 ms 17384 KiB
hand_12.txt AC 49 ms 17584 KiB
hand_13.txt AC 67 ms 17604 KiB
hand_14.txt AC 80 ms 17388 KiB
hand_15.txt AC 42 ms 17152 KiB
hand_16.txt AC 614 ms 17476 KiB
hand_17.txt AC 42 ms 17560 KiB
hand_18.txt AC 470 ms 17352 KiB
hand_19.txt AC 43 ms 17584 KiB
hand_20.txt AC 409 ms 17740 KiB
hand_21.txt AC 44 ms 17484 KiB
hand_22.txt AC 86 ms 17556 KiB
hand_23.txt AC 128 ms 17512 KiB
hand_24.txt AC 167 ms 17496 KiB
hand_25.txt AC 43 ms 17496 KiB
hand_26.txt AC 868 ms 17684 KiB
hand_27.txt AC 43 ms 17436 KiB
hand_28.txt AC 873 ms 17732 KiB
hand_29.txt AC 183 ms 17384 KiB
hand_30.txt AC 1037 ms 17724 KiB
hand_31.txt AC 1029 ms 17476 KiB
hand_32.txt AC 146 ms 17484 KiB
hand_33.txt AC 272 ms 17384 KiB
hand_34.txt AC 208 ms 17708 KiB
hand_35.txt AC 192 ms 17612 KiB
random2_00.txt AC 42 ms 17168 KiB
random2_01.txt AC 42 ms 17040 KiB
random2_02.txt AC 42 ms 17308 KiB
random2_03.txt AC 45 ms 17384 KiB
random2_04.txt AC 42 ms 17212 KiB
random2_05.txt AC 44 ms 17332 KiB
random_00.txt AC 42 ms 17208 KiB
random_01.txt AC 42 ms 17040 KiB
random_02.txt AC 42 ms 17084 KiB
random_03.txt AC 43 ms 17552 KiB
random_04.txt AC 41 ms 17216 KiB
random_05.txt AC 47 ms 17380 KiB
random_06.txt AC 42 ms 17324 KiB
random_07.txt AC 42 ms 17396 KiB
random_08.txt AC 50 ms 17464 KiB
random_09.txt AC 43 ms 17440 KiB
random_10.txt AC 41 ms 17156 KiB
random_11.txt AC 44 ms 17548 KiB
random_12.txt AC 41 ms 17196 KiB
random_13.txt AC 110 ms 17580 KiB
random_14.txt AC 449 ms 17540 KiB
random_15.txt AC 44 ms 17448 KiB
random_16.txt AC 42 ms 16784 KiB
random_17.txt AC 41 ms 17156 KiB
random_18.txt AC 42 ms 17576 KiB
random_19.txt AC 49 ms 17524 KiB
random_20.txt AC 221 ms 17576 KiB
random_21.txt AC 46 ms 17428 KiB
random_22.txt AC 41 ms 17108 KiB
random_23.txt AC 51 ms 17396 KiB
random_24.txt AC 43 ms 17468 KiB
random_25.txt AC 46 ms 17612 KiB
random_26.txt AC 42 ms 17328 KiB
random_27.txt AC 55 ms 17432 KiB
random_28.txt AC 66 ms 17524 KiB
random_29.txt AC 604 ms 17384 KiB
random_30.txt AC 46 ms 17416 KiB
random_31.txt AC 42 ms 17428 KiB
random_32.txt AC 47 ms 17508 KiB
random_33.txt AC 48 ms 17196 KiB
random_34.txt AC 82 ms 17484 KiB
random_35.txt AC 44 ms 17564 KiB