結果
| 問題 | No.1610 She Loves Me, She Loves Me Not, ... | 
| コンテスト | |
| ユーザー |  umezo | 
| 提出日時 | 2021-07-21 22:47:48 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 10 ms / 2,000 ms | 
| コード長 | 825 bytes | 
| コンパイル時間 | 1,692 ms | 
| コンパイル使用メモリ | 199,160 KB | 
| 最終ジャッジ日時 | 2025-01-23 04:52:29 | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 32 | 
ソースコード
#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 f=false;
  while(1){
    auto t=q.front(); q.pop();
    if(t.first==-1){
      if(f) break;
      f=true;
      q.push(t);
    }
    else{
      int a=t.first,b=t.second;
      if(deg[a]==1 || deg[b]==1){
        f=false;
        deg[a]--,deg[b]--;
        ans++;
      }
      else q.push(t);
    }
  }
  if(ans%2==1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
    
  return 0;
}
            
            
            
        