# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
939066 | 2024-03-06T05:12:24 Z | ezzzay | Network (BOI15_net) | C++14 | 0 ms | 348 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define ff first #define ss second #define pb push_back const int N=3e3+5; bool vis[N]; vector<int>v[N]; vector<pair<int,int>>rts; vector<int>vec; signed main(){ int n; cin>>n; for(int i=1;i<n;i++){ int a,b; cin>>a>>b; v[a].pb(b); v[b].pb(a); rts.pb({a,b}); } for(int i=1;i<=n;i++){ if(v[i].size()==1)vec.pb(i); } cout<<vec.size()/2+vec.size()%2<<endl; vec.pb(vec[0]); for(int i=0;i<vec.size();i+=2){ cout<<vec[i]<<" "<<vec[i+1]<<endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Extra information in the output file |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Extra information in the output file |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Extra information in the output file |
2 | Halted | 0 ms | 0 KB | - |