結果
問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
ユーザー |
|
提出日時 | 2021-10-18 12:30:59 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 149 ms / 2,000 ms |
コード長 | 963 bytes |
コンパイル時間 | 412 ms |
コンパイル使用メモリ | 82,060 KB |
実行使用メモリ | 89,856 KB |
最終ジャッジ日時 | 2024-09-19 06:15:22 |
合計ジャッジ時間 | 6,189 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """4 3 # 1 2 # 1 3 # 1 4 # """ # sys.stdin = io.StringIO(_INPUT) INF = 10**10 YES = 'Yes' NO = 'No' N, M = map(int, input().split()) G = [list() for _ in range(N)] InDegree = [0] * N for _ in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 G[a].append(b) G[b].append(a) InDegree[a] += 1 InDegree[b] += 1 L = [i for i in range(N) if InDegree[i] == 1] n = 0 while L: p = L.pop() if InDegree[p] >= 1: n += 1 InDegree[p] -= 1 for p1 in G[p]: if InDegree[p1]: InDegree[p1] -= 1 if InDegree[p1] == 1: L.append(p1) if n % 2 == 1: print('Yes') else: print('No')