結果
| 問題 | No.2202 贅沢てりたまチキン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-03 22:39:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 734 bytes |
| 記録 | |
| コンパイル時間 | 90 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 185,652 KB |
| 最終ジャッジ日時 | 2024-07-02 20:46:18 |
| 合計ジャッジ時間 | 11,730 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 TLE * 4 -- * 10 |
ソースコード
from collections import deque
from collections import defaultdict
n, m = (int(x) for x in input().split())
l = defaultdict(list)
for i in range(m):
a, b = (int(x) for x in input().split())
a -= 1
b -= 1
l[str(a)+"up"].append(str(b)+"down")
l[str(a)+"down"].append(str(b)+"up")
l[str(b)+"up"].append(str(a)+"down")
l[str(b)+"down"].append(str(a)+"up")
def bfs(u):
queue = deque([u])
S = set(); S.add(u)
while queue:
v = queue.popleft()
for i in l[v]:
if not i in S:
queue.append(i)
S.add(i)
return S
for i in range(n):
d = bfs(str(i) + "up")
if str(i) + "down" not in d:
print("No")
exit()
print("Yes")