結果

問題 No.479 頂点は要らない
ユーザー 双六
提出日時 2020-08-10 04:30:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 324 ms / 1,500 ms
コード長 602 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 94,464 KB
最終ジャッジ日時 2024-10-06 00:55:52
合計ジャッジ時間 6,776 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	edge = []
	ans = [0] * N
	for i in range(M):
		a, b = getlist()
		edge.append([a, b])

	edge.sort()

	for i in range(M):
		a, b = edge[-1 - i]
		if ans[a] == 0 and ans[b] == 0:
			ans[a] = 1

	while True:
		if ans[-1] == 0:
			ans.pop()
		else:
			break

	anspre = "".join(list(map(str, ans)))
	print(anspre[::-1])


if __name__ == '__main__':
	main()
0