結果

問題 No.806 木を道に
ユーザー sigmanisigmani
提出日時 2022-02-19 18:10:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 1,365 ms
コンパイル使用メモリ 168,116 KB
実行使用メモリ 9,040 KB
最終ジャッジ日時 2024-06-29 10:35:24
合計ジャッジ時間 3,024 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
vector<int>G[101010];
int main(){
  int N;
  cin>>N;
  int V=N;
  int E=N-1;
  for(int i=1;i<=E;i++){
    int A,B;
    cin>>A>>B;
    G[A].push_back(B);
    G[B].push_back(A);
  }
  int answer=0;
  for(int i=1;i<=E;i++){
    if(G[i].size()>=2)answer=answer+G[i].size()-2;
  }
cout<<answer;


}
0