結果
問題 | No.20 砂漠のオアシス |
ユーザー | 6soukiti29 |
提出日時 | 2017-07-26 22:14:25 |
言語 | Nim (2.0.2) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,584 bytes |
コンパイル時間 | 3,390 ms |
コンパイル使用メモリ | 71,184 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-09-12 13:36:56 |
合計ジャッジ時間 | 6,546 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 4 ms
4,380 KB |
testcase_02 | AC | 4 ms
4,380 KB |
testcase_03 | AC | 50 ms
4,376 KB |
testcase_04 | AC | 46 ms
4,376 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 3 ms
4,376 KB |
testcase_12 | AC | 17 ms
4,380 KB |
testcase_13 | AC | 25 ms
4,376 KB |
testcase_14 | AC | 51 ms
4,376 KB |
testcase_15 | AC | 37 ms
4,380 KB |
testcase_16 | AC | 131 ms
4,376 KB |
testcase_17 | AC | 91 ms
4,376 KB |
testcase_18 | AC | 98 ms
4,380 KB |
testcase_19 | AC | 122 ms
4,376 KB |
testcase_20 | AC | 12 ms
4,376 KB |
ソースコード
import sequtils,strutils,deques type zahyou = tuple[x : int, y : int] var N,V,Ox,Oy : int sabaku : array[202,array[202,int]] line : seq[int] D = [[1,0],[0,1],[-1,0],[0,-1]] startcost : seq[seq[int]] gorlcost : seq[seq[int]] p : zahyou (N,V,Ox,Oy) = stdin.readline.split.map(parseInt) for i in 0..201: for j in 0..201: sabaku[i][j] = 1000000 for i in 0..<N: line = stdin.readline.split.map(parseInt) for j in 0..<N: sabaku[i + 1][j + 1] = line[j] for i in 0..1: var S = newSeqWith(N + 2,newSeqWith(N + 2,1000000)) update = initDeque[zahyou](4096) s : set[int16] k : int16 if i == 0: p = (1,1) update.addLast(p) s.incl(201) S[1][1] = 0 else: p = (N,N) update.addLast(p) s.incl((N * 200 + N).int16) S[N][N] = sabaku[N][N] while s.card > 0: p = update.popFirst k = (p.y * 200 + p.x).int16 s.excl(k) for d in D: if S[p.x + d[0]][p.y + d[1]] > S[p.x][p.y] + sabaku[p.x + d[0]][p.y + d[1]]: S[p.x + d[0]][p.y + d[1]] = S[p.x][p.y] + sabaku[p.x + d[0]][p.y + d[1]] k = ((p.y + d[1]) * 200 + p.x + d[0]).int16 if k notin s: s.incl(k) update.addLast((p.x + d[0],p.y + d[1])) if i == 0: startcost = S else: gorlcost = S var Vo = V - startcost[Oy][Ox] Vo *= 2 Vo += sabaku[Oy][Ox] if Vo > gorlcost[Oy][Ox] or startcost[N][N] < V: echo "YES" else: echo "NO"