結果

問題 No.2418 情報通だよ!Nafmoくん
ユーザー igeeeigeee
提出日時 2023-08-12 15:26:06
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 1,176 bytes
コンパイル時間 4,624 ms
コンパイル使用メモリ 264,668 KB
実行使用メモリ 14,812 KB
最終ジャッジ日時 2024-04-30 09:17:36
合計ジャッジ時間 6,345 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 69 ms
13,080 KB
testcase_04 AC 21 ms
12,544 KB
testcase_05 AC 44 ms
6,944 KB
testcase_06 AC 50 ms
12,740 KB
testcase_07 AC 46 ms
6,944 KB
testcase_08 AC 54 ms
14,812 KB
testcase_09 AC 57 ms
7,552 KB
testcase_10 AC 69 ms
11,860 KB
testcase_11 AC 60 ms
11,392 KB
testcase_12 AC 43 ms
9,984 KB
testcase_13 AC 21 ms
6,940 KB
testcase_14 AC 38 ms
8,064 KB
testcase_15 AC 39 ms
6,940 KB
testcase_16 AC 68 ms
9,320 KB
testcase_17 AC 20 ms
6,944 KB
testcase_18 AC 40 ms
11,116 KB
testcase_19 AC 17 ms
11,676 KB
testcase_20 AC 43 ms
6,940 KB
testcase_21 AC 24 ms
6,940 KB
testcase_22 AC 25 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define repn(i,end) for(long long i = 0; i <= (long long)(end); i++)
#define reps(i,start,end) for(long long i = start; i < (long long)(end); i++)
#define repsn(i,start,end) for(long long i = start; i <= (long long)(end); i++)
#define ll long long
#define ld long double
#define print(t) cout << t << endl 
#define all(a)  (a).begin(),(a).end()
// << std::fixed << std::setprecision(0)
const ll INF = 1LL << 60;
 
template<class T> bool chmin(T& a, T b){
 if(a > b){
  a = b;
  return true;
 }
  return false;
}
 
template<class T> bool chmax(T& a, T b){
 if(a < b){
  a = b;
  return true;
 }
  return false;
}
  
ll lpow(ll x,ll n){
  ll ans = 1;
  while(n >0){
    if(n & 1)ans *= x;
    x *= x;
    n >>= 1;
  }
  return ans;
}
 
int main(){
  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<vector<int>> gru = uf.groups();
  ll ans = 0;
  rep(i,gru.size()){
    if(gru[i].size() %2 != 0){
      ans++;
    }
  }
  cout << ans/2 << endl;
}
0