結果
問題 | No.323 yuki国 |
ユーザー | はむ吉🐹 |
提出日時 | 2016-03-10 22:50:08 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,728 bytes |
コンパイル時間 | 723 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 679,688 KB |
最終ジャッジ日時 | 2024-09-24 17:47:45 |
合計ジャッジ時間 | 7,962 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | AC | 43 ms
54,388 KB |
testcase_02 | AC | 44 ms
55,260 KB |
testcase_03 | AC | 49 ms
61,388 KB |
testcase_04 | AC | 44 ms
55,252 KB |
testcase_05 | AC | 117 ms
81,288 KB |
testcase_06 | AC | 86 ms
78,244 KB |
testcase_07 | AC | 43 ms
55,204 KB |
testcase_08 | TLE | - |
testcase_09 | AC | 3,391 ms
402,664 KB |
testcase_10 | AC | 43 ms
55,128 KB |
testcase_11 | AC | 63 ms
71,264 KB |
testcase_12 | AC | 64 ms
71,552 KB |
testcase_13 | AC | 2,769 ms
402,548 KB |
testcase_14 | TLE | - |
testcase_15 | AC | 2,240 ms
344,460 KB |
testcase_16 | TLE | - |
testcase_17 | AC | 2,797 ms
402,560 KB |
testcase_18 | AC | 105 ms
78,552 KB |
testcase_19 | AC | 3,294 ms
422,972 KB |
testcase_20 | AC | 136 ms
83,268 KB |
testcase_21 | TLE | - |
testcase_22 | AC | 832 ms
193,500 KB |
testcase_23 | TLE | - |
testcase_24 | AC | 307 ms
103,608 KB |
testcase_25 | AC | 2,504 ms
400,632 KB |
testcase_26 | AC | 258 ms
100,516 KB |
testcase_27 | TLE | - |
testcase_28 | AC | 2,943 ms
402,532 KB |
testcase_29 | AC | 2,931 ms
402,788 KB |
testcase_30 | AC | 43 ms
55,064 KB |
testcase_31 | AC | 77 ms
76,940 KB |
testcase_32 | AC | 88 ms
77,084 KB |
testcase_33 | AC | 78 ms
77,000 KB |
testcase_34 | AC | 101 ms
78,584 KB |
testcase_35 | AC | 76 ms
54,940 KB |
testcase_36 | AC | 93 ms
77,604 KB |
testcase_37 | AC | 44 ms
55,364 KB |
ソースコード
#!/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()