結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,036 KB
testcase_01 AC 78 ms
15,304 KB
testcase_02 AC 82 ms
15,120 KB
testcase_03 AC 78 ms
15,048 KB
testcase_04 AC 114 ms
15,440 KB
testcase_05 AC 128 ms
15,644 KB
testcase_06 AC 105 ms
15,300 KB
testcase_07 AC 193 ms
16,008 KB
testcase_08 AC 213 ms
16,500 KB
testcase_09 AC 175 ms
16,100 KB
testcase_10 AC 110 ms
16,076 KB
testcase_11 AC 144 ms
16,396 KB
testcase_12 AC 91 ms
15,564 KB
testcase_13 AC 371 ms
18,540 KB
testcase_14 AC 369 ms
18,404 KB
testcase_15 AC 81 ms
15,248 KB
testcase_16 AC 108 ms
15,656 KB
testcase_17 AC 81 ms
15,340 KB
testcase_18 AC 83 ms
15,044 KB
testcase_19 AC 193 ms
16,452 KB
testcase_20 AC 266 ms
17,060 KB
testcase_21 AC 85 ms
15,504 KB
testcase_22 AC 89 ms
15,544 KB
testcase_23 AC 81 ms
15,184 KB
testcase_24 AC 297 ms
17,436 KB
testcase_25 AC 113 ms
15,528 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:11: 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=Hash.new 0
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&&v[x=[a,b]]<y}}
q=z)until q.empty?
p -1
0