結果
問題 |
No.806 木を道に
|
ユーザー |
|
提出日時 | 2022-02-19 18:15:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 339 bytes |
コンパイル時間 | 1,559 ms |
コンパイル使用メモリ | 168,088 KB |
実行使用メモリ | 8,976 KB |
最終ジャッジ日時 | 2024-06-29 10:35:36 |
合計ジャッジ時間 | 3,130 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
#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<=V;i++){ if(G[i].size()>=3)answer=answer+G[i].size()-2; } cout<<answer; }