結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,948 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 38 ms
13,108 KB
testcase_04 AC 20 ms
12,392 KB
testcase_05 AC 20 ms
6,944 KB
testcase_06 AC 35 ms
12,676 KB
testcase_07 AC 18 ms
6,944 KB
testcase_08 AC 34 ms
14,848 KB
testcase_09 AC 25 ms
7,424 KB
testcase_10 AC 35 ms
11,776 KB
testcase_11 AC 31 ms
11,292 KB
testcase_12 AC 24 ms
9,948 KB
testcase_13 AC 11 ms
6,944 KB
testcase_14 AC 20 ms
8,064 KB
testcase_15 AC 14 ms
6,940 KB
testcase_16 AC 31 ms
9,316 KB
testcase_17 AC 8 ms
6,940 KB
testcase_18 AC 24 ms
11,076 KB
testcase_19 AC 18 ms
11,712 KB
testcase_20 AC 15 ms
6,944 KB
testcase_21 AC 15 ms
6,940 KB
testcase_22 AC 11 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// g++-13 1.cpp -std=c++17 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using ld = long double;
 
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
 
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n,m;cin>>n>>m;
  dsu d(2*n);
  rep(i,0,m){
    int a,b;cin>>a>>b;
    a--;b--;
    d.merge(a,b);
  }

  int ans=0;
  vvi g=d.groups();
  for(vi v:g){
    ans+=v.size()%2;
  }

  cout<<ans/2<<endl;
}
0