結果
問題 | No.323 yuki国 |
ユーザー | yn |
提出日時 | 2016-06-11 16:50:48 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,000 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 136,192 KB |
最終ジャッジ日時 | 2024-04-17 18:47:19 |
合計ジャッジ時間 | 8,088 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
57,984 KB |
testcase_01 | AC | 60 ms
62,592 KB |
testcase_02 | AC | 174 ms
77,504 KB |
testcase_03 | AC | 397 ms
82,228 KB |
testcase_04 | AC | 132 ms
76,800 KB |
testcase_05 | AC | 187 ms
77,732 KB |
testcase_06 | WA | - |
testcase_07 | AC | 46 ms
52,992 KB |
testcase_08 | TLE | - |
testcase_09 | -- | - |
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 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
ソースコード
import heapq h, w = map(int,input().split()) a, si, sj = map(int,input().split()) b, gi, gj = map(int,input().split()) m = [list(input()) for i in range(h)] visited = [[[False] * 2500 for i in range(w)] for j in range(h)] q = [] visited[si][sj][a] = True heapq.heappush(q, (si, sj, a)) dx = [0, 1, 0,-1] dy = [1, 0,-1, 0] while len(q): curi, curj, cursize = heapq.heappop(q) for i in range(4): nexti = curi + dx[i] nextj = curj + dy[i] if 0 <= nexti < h and 0 <= nextj < w: pass else: continue if m[nexti][nextj] == "*": nextsize = cursize + 1 else: nextsize = cursize - 1 if 0 <= nextsize < 2500: pass else: continue if not visited[nexti][nextj][nextsize]: visited[nexti][nextj][nextsize] = True heapq.heappush(q,(nexti, nextj, nextsize)) if visited[gi][gj][b]: print("Yes") else: print("No")