結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
graythunder1
|
| 提出日時 | 2019-06-27 16:02:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 89 ms / 2,000 ms |
| コード長 | 615 bytes |
| コンパイル時間 | 662 ms |
| コンパイル使用メモリ | 70,716 KB |
| 実行使用メモリ | 9,216 KB |
| 最終ジャッジ日時 | 2024-06-28 01:47:36 |
| 合計ジャッジ時間 | 3,386 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>
using namespace std;
typedef long long int ll;
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
int main(){
ll N;
cin >> N;
vector<vector<ll> > edges(N);
rep(i, N-1){
ll a, b;
cin >> a >> b;
edges[a-1].push_back(b-1);
edges[b-1].push_back(a-1);
}
ll ans = 0;
for(auto it = edges.begin(); it != edges.end(); ++it){
if((*it).size() >= 2) ans += (*it).size() - 2;
}
cout << ans << endl;
return 0;
}
graythunder1