結果
| 問題 | No.2888 Mamehinata |
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-11-24 06:52:34 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 411 bytes |
| 記録 | |
| コンパイル時間 | 271 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 95,232 KB |
| 最終ジャッジ日時 | 2026-05-18 05:51:57 |
| 合計ジャッジ時間 | 5,280 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 1 -- * 41 |
ソースコード
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