結果

問題 No.479 頂点は要らない
ユーザー qibqib
提出日時 2023-02-20 01:07:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 199 ms / 1,500 ms
コード長 424 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 93,924 KB
最終ジャッジ日時 2023-09-28 03:13:50
合計ジャッジ時間 7,736 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,568 KB
testcase_01 AC 63 ms
71,384 KB
testcase_02 AC 66 ms
71,288 KB
testcase_03 AC 62 ms
71,416 KB
testcase_04 AC 62 ms
71,288 KB
testcase_05 AC 62 ms
71,456 KB
testcase_06 AC 62 ms
71,288 KB
testcase_07 AC 65 ms
71,384 KB
testcase_08 AC 65 ms
71,376 KB
testcase_09 AC 64 ms
71,548 KB
testcase_10 AC 64 ms
71,124 KB
testcase_11 AC 63 ms
71,548 KB
testcase_12 AC 62 ms
71,560 KB
testcase_13 AC 62 ms
71,340 KB
testcase_14 AC 65 ms
71,372 KB
testcase_15 AC 65 ms
71,484 KB
testcase_16 AC 63 ms
71,656 KB
testcase_17 AC 62 ms
71,380 KB
testcase_18 AC 62 ms
71,156 KB
testcase_19 AC 77 ms
75,696 KB
testcase_20 AC 77 ms
75,376 KB
testcase_21 AC 80 ms
75,308 KB
testcase_22 AC 79 ms
75,620 KB
testcase_23 AC 80 ms
75,572 KB
testcase_24 AC 80 ms
75,564 KB
testcase_25 AC 73 ms
71,380 KB
testcase_26 AC 186 ms
90,332 KB
testcase_27 AC 185 ms
90,400 KB
testcase_28 AC 160 ms
93,924 KB
testcase_29 AC 161 ms
86,300 KB
testcase_30 AC 161 ms
86,304 KB
testcase_31 AC 178 ms
86,244 KB
testcase_32 AC 178 ms
86,108 KB
testcase_33 AC 189 ms
85,352 KB
testcase_34 AC 195 ms
85,632 KB
testcase_35 AC 199 ms
83,144 KB
testcase_36 AC 152 ms
80,228 KB
testcase_37 AC 199 ms
85,940 KB
testcase_38 AC 185 ms
84,544 KB
testcase_39 AC 161 ms
83,080 KB
testcase_40 AC 151 ms
85,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
g = [[] for _ in range(n)]
for e in range(m):
  a, b = map(int, input().split())
  g[a].append((b, e))

ans = ["0" for _ in range(n)]
used = [False for _ in range(m)]
for u in range(n - 1, -1, -1):
  for v, e in g[u]:
    if used[e]:
      continue
    used[e] = True
    if ans[v] == "0":
      ans[u] = "1"

while len(ans) > 1 and ans[-1] == "0":
  ans.pop()

print(''.join(reversed(ans)))
0