結果

問題 No.806 木を道に
ユーザー sigmanisigmani
提出日時 2022-02-19 18:10:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 339 bytes
コンパイル時間 1,514 ms
コンパイル使用メモリ 166,344 KB
実行使用メモリ 8,992 KB
最終ジャッジ日時 2023-09-11 20:49:54
合計ジャッジ時間 3,775 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,724 KB
testcase_01 AC 3 ms
5,828 KB
testcase_02 WA -
testcase_03 AC 3 ms
5,712 KB
testcase_04 WA -
testcase_05 AC 3 ms
5,732 KB
testcase_06 AC 3 ms
5,716 KB
testcase_07 AC 3 ms
5,716 KB
testcase_08 AC 3 ms
5,832 KB
testcase_09 AC 3 ms
5,832 KB
testcase_10 AC 17 ms
6,472 KB
testcase_11 AC 15 ms
6,336 KB
testcase_12 AC 65 ms
8,584 KB
testcase_13 AC 49 ms
7,644 KB
testcase_14 AC 60 ms
8,272 KB
testcase_15 WA -
testcase_16 AC 24 ms
6,688 KB
testcase_17 AC 57 ms
8,036 KB
testcase_18 AC 8 ms
6,020 KB
testcase_19 AC 19 ms
6,436 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 79 ms
8,884 KB
testcase_24 AC 36 ms
7,364 KB
testcase_25 AC 53 ms
8,208 KB
testcase_26 AC 21 ms
6,844 KB
testcase_27 AC 62 ms
8,812 KB
testcase_28 AC 5 ms
5,944 KB
権限があれば一括ダウンロードができます

ソースコード

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