結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,768 KB
testcase_01 AC 3 ms
5,788 KB
testcase_02 WA -
testcase_03 AC 4 ms
5,916 KB
testcase_04 WA -
testcase_05 AC 3 ms
5,832 KB
testcase_06 AC 3 ms
5,732 KB
testcase_07 AC 3 ms
5,756 KB
testcase_08 AC 3 ms
5,964 KB
testcase_09 AC 3 ms
5,708 KB
testcase_10 AC 18 ms
6,408 KB
testcase_11 AC 16 ms
6,340 KB
testcase_12 AC 66 ms
8,448 KB
testcase_13 AC 47 ms
7,852 KB
testcase_14 AC 62 ms
8,320 KB
testcase_15 WA -
testcase_16 AC 24 ms
6,692 KB
testcase_17 AC 58 ms
8,072 KB
testcase_18 AC 9 ms
6,224 KB
testcase_19 AC 18 ms
6,448 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 80 ms
8,872 KB
testcase_24 AC 36 ms
7,616 KB
testcase_25 AC 54 ms
8,268 KB
testcase_26 AC 21 ms
6,696 KB
testcase_27 AC 61 ms
8,884 KB
testcase_28 AC 5 ms
5,836 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()>=3)answer=answer+G[i].size()-2;
  }
cout<<answer;


}
0