結果
問題 | No.323 yuki国 |
ユーザー | はむ吉🐹 |
提出日時 | 2016-03-10 22:50:08 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,728 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 81,824 KB |
実行使用メモリ | 670,628 KB |
最終ジャッジ日時 | 2023-10-24 22:40:43 |
合計ジャッジ時間 | 20,970 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
55,668 KB |
testcase_01 | AC | 44 ms
55,668 KB |
testcase_02 | AC | 43 ms
55,668 KB |
testcase_03 | AC | 51 ms
61,200 KB |
testcase_04 | AC | 43 ms
55,672 KB |
testcase_05 | AC | 126 ms
80,732 KB |
testcase_06 | AC | 87 ms
77,416 KB |
testcase_07 | AC | 44 ms
55,676 KB |
testcase_08 | TLE | - |
testcase_09 | AC | 3,375 ms
402,148 KB |
testcase_10 | AC | 43 ms
55,612 KB |
testcase_11 | AC | 64 ms
70,540 KB |
testcase_12 | AC | 64 ms
70,540 KB |
testcase_13 | AC | 2,897 ms
402,316 KB |
testcase_14 | MLE | - |
testcase_15 | AC | 2,584 ms
344,388 KB |
testcase_16 | TLE | - |
testcase_17 | AC | 2,927 ms
402,392 KB |
testcase_18 | AC | 107 ms
78,180 KB |
testcase_19 | AC | 3,418 ms
422,844 KB |
testcase_20 | AC | 140 ms
83,120 KB |
testcase_21 | MLE | - |
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 | -- | - |
ソースコード
#!/usr/bin/env pypy3 # -*- coding: utf-8 -*- import collections State = collections.namedtuple("State", "size r c") class BreadthFirstSearch(object): def __init__(self, height, width, start, goal, stage): self.height = height self.width = width self.limit = 2000 self.start = start self.goal = goal self.stage = stage self.deltas = [(1, 0), (-1, 0), (0, 1), (0, -1)] self.possible = collections.defaultdict(bool) def judge(self): self.possible[self.start] = True q = collections.deque() q.append(self.start) while q: state0 = q.popleft() if state0 == self.goal: break for dr, dc in self.deltas: (r, c) = (state0.r + dr, state0.c + dc) if r < 0 or r >= self.height or c < 0 or c >= self.width: continue size = state0.size if self.stage[r][c] == "*": size += 1 else: size -= 1 if size <= 0 or size > self.limit: continue state = State(size, r, c) if self.possible[state]: continue self.possible[state] = True q.append(state) return self.possible[self.goal] def main(): height, width = map(int, input().split()) start = State(*map(int, input().split())) goal = State(*map(int, input().split())) stage = [input() for _ in range(height)] bfs = BreadthFirstSearch(height, width, start, goal, stage) print("Yes" if bfs.judge() else "No") if __name__ == '__main__': main()