結果
| 問題 |
No.2418 情報通だよ!Nafmoくん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-18 09:20:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 81 ms / 2,000 ms |
| コード長 | 391 bytes |
| コンパイル時間 | 4,360 ms |
| コンパイル使用メモリ | 254,012 KB |
| 最終ジャッジ日時 | 2025-02-20 07:11:07 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
int main() {
int N, M; cin >> N >> M;
dsu uf(2 * N);
for (int i = 0; i < M; i++) {
int a, b; cin >> a >> b;
a--, b--;
uf.merge(a, b);
}
int ans = 0;
for (auto g: uf.groups()) {
if (g.size() % 2) ans++;
}
cout << ans / 2 << endl;
return 0;
}