結果
問題 | No.34 砂漠の行商人 |
ユーザー | roiti46 |
提出日時 | 2015-02-22 18:43:26 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 534 bytes |
コンパイル時間 | 104 ms |
コンパイル使用メモリ | 6,664 KB |
実行使用メモリ | 16,288 KB |
最終ジャッジ日時 | 2023-09-06 02:59:40 |
合計ジャッジ時間 | 11,952 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 11 ms
5,872 KB |
testcase_01 | AC | 11 ms
5,980 KB |
testcase_02 | AC | 22 ms
6,124 KB |
testcase_03 | AC | 12 ms
6,008 KB |
testcase_04 | AC | 242 ms
6,572 KB |
testcase_05 | AC | 673 ms
7,052 KB |
testcase_06 | AC | 52 ms
5,980 KB |
testcase_07 | AC | 1,402 ms
7,540 KB |
testcase_08 | AC | 2,695 ms
7,948 KB |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
ソースコード
dxy = zip([1,0,-1,0],[0,1,0,-1]) N,V,Sx,Sy,Gx,Gy = map(int,raw_input().split()) Sx,Sy,Gx,Gy = Sx-1,Sy-1,Gx-1,Gy-1 L = [map(int,raw_input().split()) for i in xrange(N)] HP = [[0]*N for i in xrange(N)] que = [[Sx,Sy,V,0]] while que: x,y,v,d = que.pop(0) if (x,y) == (Gx,Gy): print d break if HP[y][x] >= v: continue HP[y][x] = v for dx,dy in dxy: nx,ny = x+dx,y+dy if 0 <= nx < N and 0 <= ny < N and v-L[ny][nx] > 0: que.append([nx,ny,v-L[ny][nx],d+1]) else: print -1