結果
| 問題 |
No.3340 Simple Graph Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-14 00:12:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 955 bytes |
| コンパイル時間 | 314 ms |
| コンパイル使用メモリ | 81,968 KB |
| 実行使用メモリ | 98,144 KB |
| 最終ジャッジ日時 | 2025-11-14 00:12:57 |
| 合計ジャッジ時間 | 11,916 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 53 WA * 5 |
ソースコード
from collections import deque
n, m = map(int, input().split())
ginv = [[] for _ in range(n)]
l = [0] * n
for _ in range(m):
_u, _v = map(lambda x: int(x) - 1, input().split())
ginv[_v].append(_u)
l[_u] += 1
det = [0] * n
Q = deque([])
for v, x in enumerate(l):
if x == 0:
det[v] = -1
for u in ginv[v]:
Q.append(u)
if not Q:
print("Draw")
quit()
if det[0] == -1:
print("Bob")
quit()
while Q:
v = Q.popleft()
if det[v] == 1:
continue
det[v] = 1
if v == 0:
print("Alice")
quit()
for u in ginv[v]:
if det[u] == 0:
det[u] = -l[u]
elif det[u] < -1:
det[u] += 1
if det[u] == -1:
if u == 0:
print("Bob")
quit()
for w in ginv[u]:
Q.append(w)
if det[0] == 1:
print("Alice")
elif det[0] < 0:
print("Bob")
else:
print("Draw")