結果
| 問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-22 01:09:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 697 bytes |
| コンパイル時間 | 1,902 ms |
| コンパイル使用メモリ | 198,724 KB |
| 最終ジャッジ日時 | 2025-01-23 05:37:40 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
typedef long long ll;
int main() {
cin.tie(0); ios::sync_with_stdio(false);
int N, M; cin >> N >> M;
set<int> G[N];
rep(i, M) {
int A, B; cin >> A >> B;
G[A-1].insert(B-1);
G[B-1].insert(A-1);
}
rep(i, N) {
bool flag = true;
rep(v, N) if (G[v].size()==1) {
int nv = *G[v].begin();
G[v].erase(nv);
G[nv].erase(v);
flag = false;
break;
}
if (flag) {
cout << (i%2==0 ? "No" : "Yes") << endl;
break;
}
}
}