結果
| 問題 |
No.2888 Mamehinata
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-11-24 06:52:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 411 bytes |
| コンパイル時間 | 361 ms |
| コンパイル使用メモリ | 82,148 KB |
| 実行使用メモリ | 298,760 KB |
| 最終ジャッジ日時 | 2024-11-24 06:54:11 |
| 合計ジャッジ時間 | 95,858 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 TLE * 29 |
ソースコード
from collections import defaultdict
N, M = map(int, input().split())
adj = defaultdict(list)
for _ in range(M):
u, v = map(lambda x: int(x)-1, input().split())
adj[u].append(v)
adj[v].append(u)
blacks = {0}
for _ in range(N):
nodes = set()
for v in blacks:
for to in adj[v]:
if to in blacks: continue
nodes.add(to)
print(len(nodes))
blacks = nodes
norioc