結果

問題 No.479 頂点は要らない
ユーザー maspymaspy
提出日時 2020-03-03 10:02:44
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 186 ms / 1,500 ms
コード長 556 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 31,700 KB
最終ジャッジ日時 2023-08-04 00:47:43
合計ジャッジ時間 4,638 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,952 KB
testcase_01 AC 16 ms
7,836 KB
testcase_02 AC 17 ms
7,840 KB
testcase_03 AC 16 ms
7,916 KB
testcase_04 AC 16 ms
7,764 KB
testcase_05 AC 16 ms
7,760 KB
testcase_06 AC 16 ms
7,804 KB
testcase_07 AC 16 ms
7,932 KB
testcase_08 AC 16 ms
7,940 KB
testcase_09 AC 16 ms
7,752 KB
testcase_10 AC 16 ms
7,852 KB
testcase_11 AC 16 ms
7,936 KB
testcase_12 AC 16 ms
7,928 KB
testcase_13 AC 16 ms
7,932 KB
testcase_14 AC 15 ms
7,764 KB
testcase_15 AC 16 ms
7,900 KB
testcase_16 AC 16 ms
7,764 KB
testcase_17 AC 16 ms
7,912 KB
testcase_18 AC 16 ms
7,948 KB
testcase_19 AC 17 ms
8,368 KB
testcase_20 AC 17 ms
8,348 KB
testcase_21 AC 16 ms
7,928 KB
testcase_22 AC 17 ms
8,396 KB
testcase_23 AC 17 ms
8,240 KB
testcase_24 AC 17 ms
8,220 KB
testcase_25 AC 17 ms
8,240 KB
testcase_26 AC 185 ms
31,700 KB
testcase_27 AC 186 ms
31,672 KB
testcase_28 AC 142 ms
29,984 KB
testcase_29 AC 122 ms
27,868 KB
testcase_30 AC 123 ms
27,772 KB
testcase_31 AC 120 ms
27,840 KB
testcase_32 AC 121 ms
27,736 KB
testcase_33 AC 131 ms
25,664 KB
testcase_34 AC 139 ms
26,968 KB
testcase_35 AC 115 ms
25,228 KB
testcase_36 AC 71 ms
18,296 KB
testcase_37 AC 143 ms
26,932 KB
testcase_38 AC 117 ms
23,220 KB
testcase_39 AC 92 ms
19,632 KB
testcase_40 AC 115 ms
22,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# %%
N, M = map(int, readline().split())
m = map(int, read().split())
AB = zip(m, m)

# %%
G = [[] for _ in range(N)]
for a, b in AB:
    if a > b:
        a, b = b, a
    G[b].append(a)


# %%
buy = [False] * N
for n in range(N - 1, -1, -1):
    if buy[n]:
        continue
    for v in G[n]:
        buy[v] = True

# %%
while not buy[-1]:
    buy.pop()
print(''.join('1' if bl else '0' for bl in buy[::-1]))
0