結果

問題 No.2418 情報通だよ!Nafmoくん
ユーザー yansi819yansi819
提出日時 2024-03-18 09:20:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 5,213 ms
コンパイル使用メモリ 265,468 KB
実行使用メモリ 14,956 KB
最終ジャッジ日時 2024-03-18 09:20:22
合計ジャッジ時間 8,830 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 85 ms
13,180 KB
testcase_04 AC 28 ms
12,544 KB
testcase_05 AC 47 ms
6,676 KB
testcase_06 AC 57 ms
12,820 KB
testcase_07 AC 47 ms
6,676 KB
testcase_08 AC 61 ms
14,956 KB
testcase_09 AC 59 ms
7,552 KB
testcase_10 AC 78 ms
11,992 KB
testcase_11 AC 69 ms
11,392 KB
testcase_12 AC 48 ms
10,112 KB
testcase_13 AC 22 ms
6,676 KB
testcase_14 AC 39 ms
8,064 KB
testcase_15 AC 41 ms
6,676 KB
testcase_16 AC 73 ms
9,472 KB
testcase_17 AC 21 ms
6,676 KB
testcase_18 AC 46 ms
11,264 KB
testcase_19 AC 22 ms
11,904 KB
testcase_20 AC 44 ms
6,676 KB
testcase_21 AC 30 ms
6,784 KB
testcase_22 AC 25 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0