結果
問題 | No.1610 She Loves Me, She Loves Me Not, ... |
ユーザー |
![]() |
提出日時 | 2021-07-21 21:36:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 1,313 bytes |
コンパイル時間 | 1,751 ms |
コンパイル使用メモリ | 175,816 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-17 16:49:22 |
合計ジャッジ時間 | 3,183 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long #define REP(i,m,n) for(int i=(m);i<(n);i++) #define rep(i,n) REP(i,0,n) #define pb push_back #define all(a) a.begin(),a.end() #define rall(c) (c).rbegin(),(c).rend() #define mp make_pair #define endl '\n' //#define vec vector<ll> //#define mat vector<vector<ll> > #define fi first #define se second #define double long double typedef long long ll; typedef unsigned long long ull; typedef pair<ll,ll> pll; //typedef long double ld; typedef complex<double> Complex; const ll INF=1e9+7; const ll MOD=998244353; const ll inf=INF*INF; const ll mod=INF; const ll MAX=1000010; const double PI=acos(-1.0); typedef vector<vector<ll> > mat; typedef vector<ll> vec; signed main(){ ll n,m;cin>>n>>m; vector<vector<ll> >G(n); rep(i,m){ ll a,b;cin>>a>>b; a--;b--; G[a].pb(b); G[b].pb(a); } queue<ll>q; vector<ll>d(n); rep(i,n){ d[i]=G[i].size(); if(G[i].size()==1){ q.push(i); } } ll cnt=0; while(!q.empty()){ ll k=q.front(); q.pop(); bool f=0; if(d[k]==0)continue; cnt++; for(auto e:G[k]){ d[e]--; if(d[e]==1)q.push(e); } } cout<<(cnt%2?"Yes":"No")<<endl; }