結果
| 問題 |
No.506 限られたジャパリまん
|
| コンテスト | |
| ユーザー |
char134217728
|
| 提出日時 | 2017-08-11 06:55:54 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 599 bytes |
| コンパイル時間 | 93 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 14,464 KB |
| 最終ジャッジ日時 | 2024-06-28 04:20:21 |
| 合計ジャッジ時間 | 5,017 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 9 |
コンパイルメッセージ
Syntax OK
ソースコード
h, w, k, p = gets.split.map &:to_i
m = {}
f = k.times.map do |i|
x, y, n = gets.split
m[33 * x.to_i + y.to_i] = i
n
end
comb = [*0...k].combination(p).to_a
ans = [0, []]
comb.each do |arr|
a = []
(h+1).times do |_h|
a << []
(w+1).times do |_w|
i = m[33 * _h + _w]
if i && !arr.index(i)
a[_h][_w] = 0
next
end
if _h == 0 || _w == 0
a[_h][_w] = 1
else
a[_h][_w] = a[_h-1][_w] + a[_h][_w-1]
end
end
end
if ans[0] < a[h][w]
ans = [a[h][w], arr]
end
end
puts ans[0] % (10**9+7)
ans[1].each{|i| puts f[i]}
char134217728