結果

問題 No.2664 Prime Sum
ユーザー kotatsugamekotatsugame
提出日時 2024-03-08 21:02:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 77,584 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-29 18:49:26
合計ジャッジ時間 1,523 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/dsu>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N,M;
	cin>>N>>M;
	atcoder::dsu uf(N+N);
	for(;M--;)
	{
		int a,b;cin>>a>>b;a--,b--;
		uf.merge(a,b+N);
		uf.merge(a+N,b);
		if(uf.same(a,a+N))
		{
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
}
0