結果

問題 No.2202 贅沢てりたまチキン
ユーザー hiro1729hiro1729
提出日時 2023-09-02 08:28:49
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 100,304 KB
実行使用メモリ 4,752 KB
最終ジャッジ日時 2023-09-02 08:28:56
合計ジャッジ時間 5,979 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 3 ms
4,696 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 114 ms
4,752 KB
testcase_15 AC 111 ms
4,640 KB
testcase_16 AC 86 ms
4,684 KB
testcase_17 AC 88 ms
4,676 KB
testcase_18 AC 43 ms
4,380 KB
testcase_19 AC 57 ms
4,500 KB
testcase_20 AC 116 ms
4,492 KB
testcase_21 AC 115 ms
4,496 KB
testcase_22 AC 103 ms
4,380 KB
testcase_23 AC 92 ms
4,380 KB
testcase_24 AC 84 ms
4,376 KB
testcase_25 AC 127 ms
4,580 KB
testcase_26 AC 114 ms
4,648 KB
testcase_27 AC 112 ms
4,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <atcoder/dsu>
using namespace std;
using namespace atcoder;

int main() {
	int n, m;
	cin >> n >> m;
	dsu uf(2 * n);
	while (m--) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		uf.merge(a, b + n);
		uf.merge(a + n, b);
	}
	for (int i = 0; i < n; i++) {
		if (!uf.same(i, i + n)) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
}
0