結果
問題 | No.1610 She Loves Me, She Loves Me Not, ... |
ユーザー |
![]() |
提出日時 | 2021-07-21 21:32:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 1,787 ms |
コンパイル使用メモリ | 200,016 KB |
最終ジャッジ日時 | 2025-01-23 03:30:54 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#include "bits/stdc++.h" #define int long long using namespace std; using ll = long long; using P = pair<ll, ll>; const ll INF = (1LL << 61); ll mod = 1000000007; int N, M; signed main() { ios::sync_with_stdio(false); cin.tie(0); cin >> N >> M; vector<set<int>>G(N); for (int i = 0; i < M; i++) { int a, b; cin >> a >> b; a--; b--; G[a].insert(b); G[b].insert(a); } int cnt = 0; for (int i = 0; i < 5010; i++) { for (int j = 0; j < N; j++) { if (G[j].size() == 1) { cnt++; int x = *G[j].begin(); G[j].erase(x); G[x].erase(j); } } } if (cnt % 2 == 1)cout << "Yes" << endl; else cout << "No" << endl; return 0; }