結果
問題 | No.2418 情報通だよ!Nafmoくん |
ユーザー |
![]() |
提出日時 | 2024-11-15 17:11:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 448 bytes |
コンパイル時間 | 2,120 ms |
コンパイル使用メモリ | 203,644 KB |
最終ジャッジ日時 | 2025-02-25 04:16:45 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include <atcoder/dsu> using namespace atcoder; int main() { fast_io(); 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++; } } ans /= 2; cout << ans << endl; }