結果

問題 No.479 頂点は要らない
コンテスト
ユーザー nanae
提出日時 2017-01-28 00:04:47
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 751 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 170 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 119,480 KB
最終ジャッジ日時 2026-05-29 17:16:15
合計ジャッジ時間 4,859 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 TLE * 1 -- * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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())

while 1:
    max_v = max(processed)

    if max_v == -1:
        break

    processed[max_v] = -1

    for node in edges[max_v]:
        buy[node] = '1'
        processed[node] = -1

# debug(buy, locals())

ans = ''.join([str(b) for b in reversed(buy)])
ans = ans.lstrip('0')

print(ans)
0