結果

問題 No.783 門松計画
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-19 09:55:35
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,683 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 11,640 KB
実行使用メモリ 20,360 KB
最終ジャッジ日時 2023-09-30 18:41:48
合計ジャッジ時間 13,483 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
20,332 KB
testcase_01 AC 199 ms
20,124 KB
testcase_02 AC 131 ms
20,332 KB
testcase_03 AC 97 ms
20,332 KB
testcase_04 AC 107 ms
20,360 KB
testcase_05 AC 123 ms
20,284 KB
testcase_06 AC 112 ms
20,192 KB
testcase_07 AC 113 ms
20,228 KB
testcase_08 AC 101 ms
20,064 KB
testcase_09 AC 125 ms
20,128 KB
testcase_10 AC 1,497 ms
20,244 KB
testcase_11 AC 1,683 ms
20,112 KB
testcase_12 AC 1,554 ms
20,328 KB
testcase_13 AC 517 ms
20,128 KB
testcase_14 AC 1,014 ms
20,300 KB
testcase_15 AC 526 ms
20,260 KB
testcase_16 AC 230 ms
20,116 KB
testcase_17 AC 539 ms
20,272 KB
testcase_18 AC 138 ms
20,260 KB
testcase_19 AC 862 ms
20,160 KB
testcase_20 AC 139 ms
20,236 KB
testcase_21 AC 221 ms
20,180 KB
testcase_22 AC 248 ms
20,192 KB
testcase_23 AC 119 ms
20,004 KB
testcase_24 AC 632 ms
20,008 KB
testcase_25 AC 420 ms
20,320 KB
testcase_26 AC 613 ms
20,080 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,c=gets.split.map &:to_i
l=gets.split.map &:to_i
w=gets.split.map &:to_i
d=(0..150).map{(0..50).map{[0]*51}}
(0...n).each{|i|(0...n).each{|j|(0...n).each{|k|d[b=w[i]+w[j]+w[k]][y=l[j]][z=l[k]]=[d[b][y][z],(x=l[i])!=z&&0<(x-y)*(z-y)?x+y+z:0].max}}}
(0..c).each{|a|(0..50).each{|x|(0..50).each{|y|(0...n).each{|i|d[b=a+w[i]][y][z=l[i]]=[d[b][y][z],(e=d[a][x][y])>0&&x!=z&&0<(x-y)*(z-y)?e+z:0].max}}}}
p d[0,c+1].map{|f|f.map(&:max).max}.max
0