結果
問題 | No.479 頂点は要らない |
ユーザー | tktk_snsn |
提出日時 | 2021-01-11 02:30:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 157 ms / 1,500 ms |
コード長 | 514 bytes |
コンパイル時間 | 148 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 96,160 KB |
最終ジャッジ日時 | 2024-11-21 08:40:32 |
合計ジャッジ時間 | 4,885 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) N, M = map(int, input().split()) G = [[] for _ in range(N)] for _ in range(M): a, b = map(int, input().split()) G[a].append(b) G[b].append(a) seen = [0] * N buy = [0] * N for s in reversed(range(N)): if seen[s]: continue seen[s] = 1 for t in G[s]: if seen[t]: continue buy[t] = 1 seen[t] = 1 while buy and buy[-1] == 0: buy.pop() buy.reverse() print(*buy, sep="")