結果

問題 No.783 門松計画
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-19 09:53:27
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 426 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 11,236 KB
実行使用メモリ 23,324 KB
最終ジャッジ日時 2023-09-22 20:25:08
合計ジャッジ時間 18,971 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
23,220 KB
testcase_01 AC 228 ms
23,184 KB
testcase_02 AC 134 ms
23,104 KB
testcase_03 AC 92 ms
23,168 KB
testcase_04 AC 101 ms
23,192 KB
testcase_05 AC 121 ms
23,088 KB
testcase_06 AC 106 ms
23,068 KB
testcase_07 AC 107 ms
23,244 KB
testcase_08 AC 97 ms
23,068 KB
testcase_09 AC 126 ms
23,084 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 716 ms
23,324 KB
testcase_14 AC 1,444 ms
23,052 KB
testcase_15 AC 703 ms
23,084 KB
testcase_16 AC 285 ms
22,976 KB
testcase_17 AC 746 ms
23,080 KB
testcase_18 AC 145 ms
23,104 KB
testcase_19 AC 1,207 ms
22,968 KB
testcase_20 AC 141 ms
23,184 KB
testcase_21 AC 265 ms
23,252 KB
testcase_22 AC 311 ms
23,268 KB
testcase_23 AC 111 ms
23,064 KB
testcase_24 AC 875 ms
23,088 KB
testcase_25 AC 560 ms
22,968 KB
testcase_26 AC 855 ms
23,264 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]*999999
(0...n).each{|i|(0...n).each{|j|(0...n).each{|k|d[b=(w[i]+w[j]+w[k])<<12|(y=l[j])<<6|(z=l[k])]=[d[b],(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]<<12|y<<6|(z=l[i])]=[d[b],(e=d[a<<12|x<<6|y])>0&&x!=z&&0<(x-y)*(z-y)?e+z:0].max}}}}
p (0..c).map{|a|d[a<<12,2048].max}.max
0