| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1350333 | Zone_zonee | Network (BOI15_net) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5+10;
int in[N];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
for(int i = 1; i < n; ++i){
int u, v;
cin >> u >> v;
in[u]++;
in[v]++;
}
vector<int> leaf;
for(int i = 1; i <= n; ++i){
if(in[i] == 1) leaf.push_back(i);
}
cout << (int(leaf.size())+1)/2 << '\n';
if(int(leaf.size())&1) cout << leaf.back() << ' ' << leaf.front() << '\n';
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
