結果

問題 No.2418 情報通だよ!Nafmoくん
ユーザー ochiaigawa
提出日時 2023-08-12 14:03:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 2,040 ms
コンパイル使用メモリ 204,300 KB
最終ジャッジ日時 2025-02-16 04:08:31
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/dsu>
using namespace std;
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  atcoder::dsu d(2 * N);
  while(M--) {
    int A, B;
    cin >> A >> B;
    d.merge(--A, --B);
  }
  int ans = 0;
  for(vector<int> g : d.groups()) {
    if((int) g.size() % 2 == 1) {
      ans++;
    }
  }
  cout << ans / 2 << '\n';
  return 0;
}
0