結果

問題 No.479 頂点は要らない
ユーザー nanaenanae
提出日時 2017-01-28 00:16:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 775 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 113,840 KB
最終ジャッジ日時 2023-08-25 11:29:53
合計ジャッジ時間 6,961 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,516 KB
testcase_01 WA -
testcase_02 AC 69 ms
71,288 KB
testcase_03 AC 69 ms
71,264 KB
testcase_04 AC 70 ms
71,540 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 72 ms
71,548 KB
testcase_11 AC 69 ms
71,372 KB
testcase_12 AC 67 ms
71,552 KB
testcase_13 AC 67 ms
71,496 KB
testcase_14 AC 68 ms
71,236 KB
testcase_15 WA -
testcase_16 AC 70 ms
71,416 KB
testcase_17 WA -
testcase_18 AC 69 ms
71,160 KB
testcase_19 AC 75 ms
71,308 KB
testcase_20 AC 74 ms
71,300 KB
testcase_21 AC 72 ms
71,268 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 170 ms
113,840 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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