結果

問題 No.479 頂点は要らない
ユーザー rlangevinrlangevin
提出日時 2023-08-13 14:08:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 218 ms / 1,500 ms
コード長 670 bytes
コンパイル時間 857 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 107,332 KB
最終ジャッジ日時 2023-08-13 14:08:56
合計ジャッジ時間 7,729 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,256 KB
testcase_01 AC 72 ms
71,348 KB
testcase_02 AC 73 ms
71,316 KB
testcase_03 AC 72 ms
71,488 KB
testcase_04 AC 74 ms
71,276 KB
testcase_05 AC 72 ms
71,464 KB
testcase_06 AC 73 ms
71,364 KB
testcase_07 AC 74 ms
71,500 KB
testcase_08 AC 74 ms
71,320 KB
testcase_09 AC 84 ms
71,484 KB
testcase_10 AC 73 ms
71,444 KB
testcase_11 AC 71 ms
71,388 KB
testcase_12 AC 73 ms
71,444 KB
testcase_13 AC 73 ms
71,360 KB
testcase_14 AC 73 ms
71,076 KB
testcase_15 AC 71 ms
71,076 KB
testcase_16 AC 73 ms
71,356 KB
testcase_17 AC 73 ms
71,388 KB
testcase_18 AC 73 ms
71,484 KB
testcase_19 AC 82 ms
75,312 KB
testcase_20 AC 81 ms
75,380 KB
testcase_21 AC 82 ms
71,192 KB
testcase_22 AC 81 ms
75,604 KB
testcase_23 AC 77 ms
71,536 KB
testcase_24 AC 79 ms
71,412 KB
testcase_25 AC 80 ms
75,624 KB
testcase_26 AC 210 ms
99,700 KB
testcase_27 AC 212 ms
99,368 KB
testcase_28 AC 170 ms
107,332 KB
testcase_29 AC 179 ms
92,328 KB
testcase_30 AC 155 ms
92,024 KB
testcase_31 AC 153 ms
91,944 KB
testcase_32 AC 152 ms
91,972 KB
testcase_33 AC 194 ms
91,220 KB
testcase_34 AC 208 ms
92,436 KB
testcase_35 AC 218 ms
89,092 KB
testcase_36 AC 138 ms
83,240 KB
testcase_37 AC 205 ms
93,036 KB
testcase_38 AC 191 ms
90,156 KB
testcase_39 AC 160 ms
87,940 KB
testcase_40 AC 178 ms
91,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    G[A].append((B, i))
    G[B].append((A, i))
    
seenV, seenE = [0] * N, [0] * M
ans = [0] * N
for i in range(N - 1, -1, -1):
    if seenV[i]:
        continue
    seenV[i] = 1
    temp = []
    for u, ind in G[i]:
        if seenE[ind]:
            continue
        temp.append(u)
        seenE[ind] = 1
    if temp:
        for u in temp:
            seenV[u] = 1
            ans[u] = 1
            
while True:
    if ans[-1] == 0:
        ans.pop()
    else:
        break
ans.reverse()

print(*ans, sep="")
0