結果
問題 |
No.479 頂点は要らない
|
ユーザー |
![]() |
提出日時 | 2023-08-13 14:08:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 180 ms / 1,500 ms |
コード長 | 670 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 82,392 KB |
実行使用メモリ | 104,132 KB |
最終ジャッジ日時 | 2024-11-21 09:55:46 |
合計ジャッジ時間 | 4,921 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
import sys input = sys.stdin.readline N, M = map(int, input().split()) G = [[] for i in range(N)] for i in range(M): A, B = map(int, input().split()) G[A].append((B, i)) G[B].append((A, i)) seenV, seenE = [0] * N, [0] * M ans = [0] * N for i in range(N - 1, -1, -1): if seenV[i]: continue seenV[i] = 1 temp = [] for u, ind in G[i]: if seenE[ind]: continue temp.append(u) seenE[ind] = 1 if temp: for u in temp: seenV[u] = 1 ans[u] = 1 while True: if ans[-1] == 0: ans.pop() else: break ans.reverse() print(*ans, sep="")