Submission #764780

#TimeUsernameProblemLanguageResultExecution timeMemory
764780vjudge1Network (BOI15_net)C++11
0 / 100
2 ms628 KiB
#include <bits/stdc++.h> using namespace std; int main(){ long long int n,a,b,cnt=0,sum,hr=0; cin>>n; vector <long long int> vec(n+1,0); vector <long long int> sa; for(int i=1;i<n;i++){ cin>>a>>b; vec[a]++; vec[b]++; // cout<<i<<endl; } bool bo=0; for(int i=1;i<=n;i++){ if(vec[i]<2){ cnt++; sa.push_back(i); // cout<<i<<endl; } else if(bo==0){ sum=i; bo=1; } } cout<<round(double(cnt)/2)/*<<"()"<<cnt*/<<endl; if(cnt%2!=0){ hr=cnt; cnt=(cnt-1); } for(int i=1;i<=cnt;i++){ if(i%2!=0){ cout<<sa[i-1]<<" "; } else{ cout<<sa[i-1]<<endl; } } if(hr%2!=0){ cout<<sa[sa.size()-1]<<" "<<sum; } system("pause"); }

Compilation message (stderr)

net.cpp: In function 'int main()':
net.cpp:72:8: warning: ignoring return value of 'int system(const char*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   72 |  system("pause");
      |  ~~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...