結果
問題 | No.34 砂漠の行商人 |
ユーザー | 6soukiti29 |
提出日時 | 2017-07-27 16:58:27 |
言語 | Nim (2.0.2) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 1,079 bytes |
コンパイル時間 | 3,477 ms |
コンパイル使用メモリ | 70,256 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-12 13:38:15 |
合計ジャッジ時間 | 4,818 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 3 ms
4,380 KB |
testcase_05 | AC | 3 ms
4,380 KB |
testcase_06 | AC | 3 ms
4,380 KB |
testcase_07 | AC | 4 ms
4,380 KB |
testcase_08 | AC | 4 ms
4,376 KB |
testcase_09 | AC | 4 ms
4,380 KB |
testcase_10 | AC | 3 ms
4,376 KB |
testcase_11 | AC | 4 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 7 ms
4,376 KB |
testcase_14 | AC | 6 ms
4,380 KB |
testcase_15 | AC | 3 ms
4,376 KB |
testcase_16 | AC | 3 ms
4,380 KB |
testcase_17 | AC | 3 ms
4,380 KB |
testcase_18 | AC | 2 ms
4,376 KB |
testcase_19 | AC | 4 ms
4,380 KB |
testcase_20 | AC | 5 ms
4,380 KB |
testcase_21 | AC | 3 ms
4,376 KB |
testcase_22 | AC | 3 ms
4,380 KB |
testcase_23 | AC | 2 ms
4,376 KB |
testcase_24 | AC | 6 ms
4,376 KB |
testcase_25 | AC | 3 ms
4,380 KB |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 33) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 33) Warning: imported and not used: 'future' [UnusedImport]
ソースコード
import sequtils,strutils,deques,future type zahyou = tuple[x,y : int] item = tuple[id : zahyou,h : int,cnt : int] var N,V,Sx,Sy,Gx,Gy : int D = [[1,0],[0,1],[-1,0],[0,-1]] (N,V,Sx,Sy,Gx,Gy) = stdin.readline.split.map(parseInt) var sabaku = newSeqWith(N + 2,newSeqWith(N + 2,100000)) S = newSeqWith(N + 2,newSeqWith(N + 2,V)) dq = initDeque[item](1024) p : zahyou t : item t2 : item flag : bool for n in 1..N: sabaku[n][1..N] = stdin.readline.split.map(parseInt) S[Sy][Sx] = 0 p = (Sx,Sy) t = (p,0,0) dq.addLast(t) while dq.len > 0 and flag == false: t = dq.popFirst p = t.id if S[p.y][p.x] < t.h: continue for d in D: var ny = p.y + d[0] nx = p.x + d[1] if S[ny][nx] > t.h + sabaku[ny][nx]: if (nx,ny) == (Gx,Gy): echo t.cnt + 1 flag = true break S[ny][nx] = t.h + sabaku[ny][nx] t2 = ((nx,ny),t.h + sabaku[ny][nx],t.cnt + 1) dq.addLast(t2) if flag == false: echo -1