結果
問題 |
No.479 頂点は要らない
|
ユーザー |
|
提出日時 | 2017-01-28 00:16:56 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 775 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 112,576 KB |
最終ジャッジ日時 | 2024-12-23 18:22:07 |
合計ジャッジ時間 | 5,744 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 13 WA * 25 |
ソースコード
import sys import math def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG: {} -> {}'.format(name, val), file=sys.stderr) return None n, m = map(int, sys.stdin.readline().split()) edges = {i:set() for i in range(n)} buy = ['0'] * n processed = list(range(0, n)) for i in range(m): a, b = map(int, sys.stdin.readline().split()) edges[a].add(b) edges[b].add(a) # debug(edges, locals()) max_v = n - 1 while max_v >= 0: for node in sorted(edges[max_v], reverse=True): buy[node] = '1' if max_v - 1 == node: max_v = node - 1 else: max_v -= 1 # debug(buy, locals()) ans = ''.join([str(b) for b in reversed(buy)]) ans = ans.lstrip('0') print(ans)