結果
| 問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-21 21:30:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 2,000 ms |
| コード長 | 797 bytes |
| コンパイル時間 | 1,293 ms |
| コンパイル使用メモリ | 132,512 KB |
| 最終ジャッジ日時 | 2025-01-23 03:29:53 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<iomanip>
#include<regex>
#include<random>
using namespace std;
#define int long long
#define uint unsigned long long
const int mod=1e9+7;
const int inf=mod*mod;
const double eps=1e-9;
set<int>G[5000];
signed main(){
int n,m,a,b;
cin>>n>>m;
while(cin>>a>>b){
a--,b--;
G[a].insert(b);
G[b].insert(a);
}
stack<int>st;
for(int i=0;i<n;i++)
if(G[i].size()==1)
st.push(i);
int cnt=0;
while(!st.empty()){
int v=st.top();
st.pop();
if(G[v].size()==1){
int u=*G[v].begin();
G[u].erase(v);
if(G[u].size()==1)
st.push(u);
G[v].erase(u);
cnt++;
}
}
cout<<(cnt%2==1?"Yes":"No")<<endl;
}