結果
問題 |
No.1610 She Loves Me, She Loves Me Not, ...
|
ユーザー |
![]() |
提出日時 | 2021-07-21 22:41:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 825 bytes |
コンパイル時間 | 1,772 ms |
コンパイル使用メモリ | 199,724 KB |
最終ジャッジ日時 | 2025-01-23 04:50:31 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 WA * 8 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include <bits/stdc++.h> using namespace std; int deg[5050]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,m; cin>>n>>m; queue<pair<int,int>> q; q.push({-1,-1}); rep(i,m){ int a,b; cin>>a>>b; deg[a]++; deg[b]++; if(a>b) swap(a,b); q.push({a,b}); } int ans=0; bool b=false; while(1){ auto t=q.front(); q.pop(); if(t.first==-1){ if(b) break; b=true; q.push(t); } else{ int a=t.first,b=t.second; if(deg[a]==1 || deg[b]==1){ b=false; deg[a]--,deg[b]--; ans++; } else q.push(t); } } if(ans%2==1) cout<<"Yes"<<endl; else cout<<"No"<<endl; return 0; }