結果

問題 No.2418 情報通だよ!Nafmoくん
ユーザー throughthrough
提出日時 2023-08-12 13:52:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 605 bytes
コンパイル時間 4,469 ms
コンパイル使用メモリ 264,496 KB
実行使用メモリ 14,848 KB
最終ジャッジ日時 2024-04-30 04:19:26
合計ジャッジ時間 5,814 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 39 ms
13,056 KB
testcase_04 AC 21 ms
12,544 KB
testcase_05 AC 19 ms
6,528 KB
testcase_06 AC 32 ms
12,672 KB
testcase_07 AC 18 ms
5,760 KB
testcase_08 AC 36 ms
14,848 KB
testcase_09 AC 24 ms
7,424 KB
testcase_10 AC 37 ms
11,904 KB
testcase_11 AC 33 ms
11,264 KB
testcase_12 AC 25 ms
9,984 KB
testcase_13 AC 11 ms
5,632 KB
testcase_14 AC 20 ms
8,064 KB
testcase_15 AC 13 ms
5,376 KB
testcase_16 AC 31 ms
9,344 KB
testcase_17 AC 8 ms
5,376 KB
testcase_18 AC 26 ms
11,008 KB
testcase_19 AC 19 ms
11,776 KB
testcase_20 AC 15 ms
5,376 KB
testcase_21 AC 14 ms
6,656 KB
testcase_22 AC 10 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
#include <atcoder/all>
using namespace atcoder;
// using mint = modint1000000007;
#define rep(i, n) for(ll i = 0; i < n; i++)

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    ll n,m; cin >> n >> m;
    dsu uf(2*n);
    rep(i,m) {
        ll a,b; cin >> a >> b;
        a--; b--;
        uf.merge(a,b);
    }
    vector g = uf.groups();
    ll rest = 0;
    for(auto group:g) if(group.size()%2) rest++;
    cout << rest/2 << endl;
    
    return 0;
}
0