結果
| 問題 |
No.806 木を道に
|
| コンテスト | |
| ユーザー |
NOSS
|
| 提出日時 | 2019-03-22 21:30:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 845 bytes |
| コンパイル時間 | 1,495 ms |
| コンパイル使用メモリ | 165,776 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 02:51:47 |
| 合計ジャッジ時間 | 2,865 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<int ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()
int main() {
int n, deg[MAX_N], cnt = 0;
cin >> n;
REP(i,n-1){
int a, b;
cin >> a >> b;
deg[--a]++;
deg[--b]++;
}
REP(i,n){
if(deg[i]==1)cnt++;
}
cout << cnt - 2 << endl;
return 0;
}
NOSS