結果
問題 |
No.806 木を道に
|
ユーザー |
![]() |
提出日時 | 2019-05-03 09:13:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 76 ms / 2,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 1,790 ms |
コンパイル使用メモリ | 168,732 KB |
実行使用メモリ | 9,088 KB |
最終ジャッジ日時 | 2024-12-31 14:07:49 |
合計ジャッジ時間 | 4,253 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define MOD 1000000007 #define INF 1e9 const int MAX_N=100010; vector<int> G[MAX_N]; int main(){ int N; cin>>N; for(int i=0;i<N-1;i++){ int a,b; cin>>a>>b; a--,b--; G[a].push_back(b); G[b].push_back(a); } int ans=0; for(int i=0;i<N;i++){ ans+=max(0,(int)G[i].size()-2); } cout<<ans<<endl; }