結果

問題 No.34 砂漠の行商人
ユーザー letrangerjpletrangerjp
提出日時 2017-06-14 02:15:06
言語 Ruby
(3.2.2)
結果
AC  
実行時間 374 ms / 5,000 ms
コード長 268 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 11,388 KB
実行使用メモリ 18,528 KB
最終ジャッジ日時 2023-09-10 19:29:24
合計ジャッジ時間 5,440 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,288 KB
testcase_01 AC 81 ms
15,240 KB
testcase_02 AC 85 ms
15,092 KB
testcase_03 AC 82 ms
15,124 KB
testcase_04 AC 117 ms
15,664 KB
testcase_05 AC 125 ms
15,708 KB
testcase_06 AC 109 ms
15,468 KB
testcase_07 AC 194 ms
16,216 KB
testcase_08 AC 216 ms
16,280 KB
testcase_09 AC 178 ms
16,220 KB
testcase_10 AC 116 ms
16,088 KB
testcase_11 AC 151 ms
16,500 KB
testcase_12 AC 95 ms
15,360 KB
testcase_13 AC 371 ms
18,528 KB
testcase_14 AC 374 ms
18,224 KB
testcase_15 AC 86 ms
15,252 KB
testcase_16 AC 112 ms
15,544 KB
testcase_17 AC 84 ms
15,280 KB
testcase_18 AC 85 ms
15,140 KB
testcase_19 AC 195 ms
16,448 KB
testcase_20 AC 264 ms
17,112 KB
testcase_21 AC 89 ms
15,716 KB
testcase_22 AC 92 ms
15,476 KB
testcase_23 AC 84 ms
15,456 KB
testcase_24 AC 297 ms
17,748 KB
testcase_25 AC 112 ms
15,612 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

eval"N,V,X,Y,*Z="+gets.split*?,
L=$<.map{|s|s.split.map(&:to_i)+M=[9e9]}+[M*N]
v={[X,Y]=>V}
q=v.dup
i=0
(i+=1
z={}
q.map{|(x,y),h|[[x+1,y],[x-1,y],[x,y+1],[x,y-1]].map{|a,b|Z==x ?(p i;exit):z[x]=v[x]=y if(y=h-L[b-1][a-1])>0&&y>(v[x=[a,b]]||0)}}
q=z)until q.empty?
p -1
0