結果

問題 No.34 砂漠の行商人
ユーザー letrangerjpletrangerjp
提出日時 2017-06-14 02:14:00
言語 Ruby
(3.3.0)
結果
AC  
実行時間 373 ms / 5,000 ms
コード長 269 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 11,312 KB
実行使用メモリ 18,520 KB
最終ジャッジ日時 2023-09-10 19:28:41
合計ジャッジ時間 5,039 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,080 KB
testcase_01 AC 81 ms
15,240 KB
testcase_02 AC 88 ms
15,288 KB
testcase_03 AC 82 ms
15,360 KB
testcase_04 AC 119 ms
15,516 KB
testcase_05 AC 128 ms
15,744 KB
testcase_06 AC 110 ms
15,728 KB
testcase_07 AC 195 ms
16,128 KB
testcase_08 AC 220 ms
16,500 KB
testcase_09 AC 181 ms
15,876 KB
testcase_10 AC 114 ms
15,888 KB
testcase_11 AC 143 ms
16,424 KB
testcase_12 AC 90 ms
15,484 KB
testcase_13 AC 369 ms
18,520 KB
testcase_14 AC 373 ms
18,472 KB
testcase_15 AC 82 ms
15,372 KB
testcase_16 AC 108 ms
15,508 KB
testcase_17 AC 82 ms
15,512 KB
testcase_18 AC 83 ms
15,040 KB
testcase_19 AC 192 ms
16,440 KB
testcase_20 AC 265 ms
17,312 KB
testcase_21 AC 84 ms
15,424 KB
testcase_22 AC 88 ms
15,396 KB
testcase_23 AC 81 ms
15,268 KB
testcase_24 AC 294 ms
17,480 KB
testcase_25 AC 104 ms
15,812 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]]||-1)}}
q=z)until q.empty?
p -1
0