結果
| 問題 | No.2418 情報通だよ!Nafmoくん |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-12 13:46:19 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 1,383 bytes |
| 記録 | |
| コンパイル時間 | 7,277 ms |
| コンパイル使用メモリ | 529,588 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2026-07-02 01:41:44 |
| 合計ジャッジ時間 | 8,150 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#ifdef SENJAN
#define _GLIBCXX_DEBUG
#else
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace atcoder;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
using bint = boost::multiprecision::cpp_int;
using graph=vector<vector<int>>;
template<class T> using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
constexpr int INF32=INT_MAX/2;
constexpr ll INF64=LLONG_MAX/2;
constexpr ld PI=3.14159265358979323846;
constexpr int dx[]={0,0,-1,1,-1,-1,1,1},dy[]={-1,1,0,0,-1,1,-1,1};
template<class T> inline bool chmax(T &a,T b){return a<b?a=b,true:false;}
template<class T> inline bool chmin(T &a,T b){return a>b?a=b,true:false;}
inline void dispYN(bool a){cout<<(a?"YES":"NO")<<endl;}
inline void dispYn(bool a){cout<<(a?"Yes":"No")<<endl;}
inline void dispyn(bool a){cout<<(a?"yes":"no")<<endl;}
void _main();
int main(){cin.tie(0)->sync_with_stdio(0);cout<<fixed<<setprecision(16);_main();}
void _main(){
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);
}
auto gr = uf.groups();
int ans = 0;
for(const auto &g:gr){
if(g.size()%2==1){
ans++;
}
}
cout << ans/2 << endl;
}