結果

問題 No.1582 Vertexes vs Edges
ユーザー kiyoshi0205
提出日時 2021-07-02 22:39:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 3,900 ms
コンパイル使用メモリ 230,296 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 12:31:10
合計ジャッジ時間 6,209 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using mint=modint1000000007;
using ll=long long;
#define rep(i,N) for(int i=0;i<N;++i)
ll N,a,b;
int main(){
  cin>>N;
  dsu g(N*2);
  rep(i,N-1){
    cin>>a>>b;
    --a;--b;
    g.merge(a,b+N);
    g.merge(b,a+N);
  }
  a=0;
  rep(i,N)a+=g.same(0,i);
  cout<<min(a,N-a)<<endl;
}
0