結果
問題 |
No.2418 情報通だよ!Nafmoくん
|
ユーザー |
|
提出日時 | 2025-10-13 02:01:27 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 3,177 ms |
コンパイル使用メモリ | 281,424 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-13 02:01:33 |
合計ジャッジ時間 | 5,723 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #include <atcoder/dsu> using namespace atcoder; int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N, M; cin >> N >> M; N *= 2; dsu uf(N); rep(i, 0, M) { int A, B; cin >> A >> B; --A, --B; uf.merge(A, B); } int ans = 0; rep(v, 0, N) if (v == uf.leader(v)) ans += uf.size(v) % 2; cout << ans/2 << '\n'; }