結果
問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
ユーザー |
![]() |
提出日時 | 2021-07-21 21:31:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 564 bytes |
コンパイル時間 | 325 ms |
コンパイル使用メモリ | 82,340 KB |
実行使用メモリ | 108,356 KB |
最終ジャッジ日時 | 2024-07-17 16:15:26 |
合計ジャッジ時間 | 4,071 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 WA * 12 |
ソースコード
N, M = [int(x) for x in input().split()] from_cnt = [0]*N to = [[]*N for _ in range(N)] for _ in range(M): a, b = [int(x)-1 for x in input().split()] to[a].append(b) to[b].append(a) from_cnt[b] += 1 from_cnt[a] += 1 s = set() q = [v for v in range(N) if from_cnt[v]>0] cnt = from_cnt[::] n = 0 ans = 0 while q and n < 10**5: n += 1 v = q.pop() for u in to[v]: if cnt[u]==0: continue if cnt[u]%2: ans ^= 1 cnt[u] -= 1 cnt[v] -= 1 q.append(u) print('Yes' if ans else 'No')