結果
| 問題 | No.1610 She Loves Me, She Loves Me Not, ... | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-07-22 03:27:30 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 6 ms / 2,000 ms | 
| コード長 | 502 bytes | 
| コンパイル時間 | 938 ms | 
| コンパイル使用メモリ | 83,536 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-17 21:09:49 | 
| 合計ジャッジ時間 | 2,080 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 32 | 
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~
            
            ソースコード
#include<iostream>
#include<set>
#include<queue>
using namespace std;
int N,M;
set<int>G[5000];
main()
{
	cin>>N>>M;
	for(int i=0;i<M;i++)
	{
		int a,b;cin>>a>>b;
		a--,b--;
		G[a].insert(b);
		G[b].insert(a);
	}
	queue<int>P;
	for(int i=0;i<N;i++)if(G[i].size()==1)P.push(i);
	int cnt=0;
	while(!P.empty())
	{
		int u=P.front();P.pop();
		if(G[u].size()!=1)continue;
		cnt++;
		int v=*G[u].begin();
		G[u].clear();
		G[v].erase(u);
		if(G[v].size()==1)P.push(v);
	}
	cout<<(cnt%2?"Yes":"No")<<endl;
}
            
            
            
        