結果

問題 No.158 奇妙なお使い
ユーザー 👑 hos.lyrichos.lyric
提出日時 2015-02-27 00:39:47
言語 Ruby
(3.3.0)
結果
AC  
実行時間 3,593 ms / 5,000 ms
コード長 431 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 11,220 KB
実行使用メモリ 144,856 KB
最終ジャッジ日時 2023-09-11 07:57:07
合計ジャッジ時間 108,555 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3,316 ms
140,100 KB
testcase_01 AC 3,165 ms
140,156 KB
testcase_02 AC 3,386 ms
140,260 KB
testcase_03 AC 3,437 ms
140,276 KB
testcase_04 AC 3,378 ms
140,260 KB
testcase_05 AC 3,547 ms
140,020 KB
testcase_06 AC 3,444 ms
140,232 KB
testcase_07 AC 3,543 ms
140,024 KB
testcase_08 AC 3,096 ms
140,072 KB
testcase_09 AC 3,231 ms
144,740 KB
testcase_10 AC 3,355 ms
140,280 KB
testcase_11 AC 3,507 ms
140,072 KB
testcase_12 AC 3,247 ms
140,176 KB
testcase_13 AC 3,343 ms
140,300 KB
testcase_14 AC 3,300 ms
140,144 KB
testcase_15 AC 3,470 ms
140,288 KB
testcase_16 AC 3,440 ms
140,104 KB
testcase_17 AC 3,394 ms
140,068 KB
testcase_18 AC 3,593 ms
140,300 KB
testcase_19 AC 3,280 ms
140,024 KB
testcase_20 AC 3,545 ms
140,196 KB
testcase_21 AC 3,548 ms
140,016 KB
testcase_22 AC 3,558 ms
140,176 KB
testcase_23 AC 3,381 ms
140,140 KB
testcase_24 AC 3,382 ms
140,416 KB
testcase_25 AC 3,061 ms
144,856 KB
testcase_26 AC 3,192 ms
140,272 KB
testcase_27 AC 3,126 ms
140,284 KB
testcase_28 AC 3,218 ms
140,188 KB
testcase_29 AC 3,077 ms
140,136 KB
testcase_30 AC 3,134 ms
140,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a,b,c=gets.split.map &:to_i
d=(0..1).map{(gets+gets).split.map &:to_i}
f=(0..10001).map{(0..11).map{[0]*101}}
0.upto(10000){|s|10.downto(0){|x|100.downto(0){|y|
  z=s-x*1000-y*100
  z<0||f[s][x][y]=([
    y>9?f[s][x+1][y-10]:0,
    z>99?f[s][x][y+1]:0
  ]+d.map{|e|
    u=x-e[0]/1000
    v=y-e[0]/100%10
    w=z-e[0]%100
    u<0||v<0||w<0?0:1+f[s-e[0]+e[1]*1000+e[2]*100+e[3]][u+e[1]][v+e[2]]
  }).max
}}}
p f[a*1000+b*100+c][a][b]
0