結果
| 問題 | No.479 頂点は要らない |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-01-28 00:16:56 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 775 bytes |
| 記録 | |
| コンパイル時間 | 687 ms |
| コンパイル使用メモリ | 84,608 KB |
| 実行使用メモリ | 114,160 KB |
| 最終ジャッジ日時 | 2026-05-29 17:32:43 |
| 合計ジャッジ時間 | 6,784 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)