結果

問題 No.479 頂点は要らない
ユーザー nanaenanae
提出日時 2017-01-28 01:15:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 435 ms / 1,500 ms
コード長 747 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 11,000 KB
実行使用メモリ 53,360 KB
最終ジャッジ日時 2023-08-25 11:47:31
合計ジャッジ時間 6,827 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,224 KB
testcase_01 AC 16 ms
8,400 KB
testcase_02 AC 16 ms
8,292 KB
testcase_03 AC 17 ms
8,048 KB
testcase_04 AC 16 ms
8,404 KB
testcase_05 AC 16 ms
8,348 KB
testcase_06 AC 16 ms
8,268 KB
testcase_07 AC 16 ms
8,276 KB
testcase_08 AC 16 ms
8,340 KB
testcase_09 AC 16 ms
8,272 KB
testcase_10 AC 17 ms
8,348 KB
testcase_11 AC 15 ms
8,404 KB
testcase_12 AC 16 ms
8,424 KB
testcase_13 AC 15 ms
7,968 KB
testcase_14 AC 16 ms
8,336 KB
testcase_15 AC 15 ms
8,276 KB
testcase_16 AC 16 ms
8,228 KB
testcase_17 AC 15 ms
8,216 KB
testcase_18 AC 16 ms
8,268 KB
testcase_19 AC 18 ms
8,652 KB
testcase_20 AC 18 ms
8,628 KB
testcase_21 AC 17 ms
8,504 KB
testcase_22 AC 19 ms
8,772 KB
testcase_23 AC 19 ms
8,768 KB
testcase_24 AC 19 ms
8,764 KB
testcase_25 AC 18 ms
8,744 KB
testcase_26 AC 435 ms
47,288 KB
testcase_27 AC 424 ms
47,308 KB
testcase_28 AC 323 ms
53,360 KB
testcase_29 AC 249 ms
39,940 KB
testcase_30 AC 256 ms
39,988 KB
testcase_31 AC 262 ms
40,152 KB
testcase_32 AC 261 ms
40,012 KB
testcase_33 AC 301 ms
35,636 KB
testcase_34 AC 321 ms
37,716 KB
testcase_35 AC 266 ms
30,772 KB
testcase_36 AC 153 ms
25,424 KB
testcase_37 AC 315 ms
36,908 KB
testcase_38 AC 257 ms
33,340 KB
testcase_39 AC 202 ms
26,184 KB
testcase_40 AC 250 ms
32,336 KB
権限があれば一括ダウンロードができます

ソースコード

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 = [False] * 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())

for i in range(n - 1, -1, -1):
    if processed[i] == True:
        continue

    processed[i] = True

    for node in edges[i]:
        buy[node] = '1'
        processed[node] = True

# debug(buy, locals())

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

print(ans)
0