Submission #859495

#TimeUsernameProblemLanguageResultExecution timeMemory
859495Tenis0206Newspapers (CEOI21_newspapers)C++11
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> using namespace std; const int nmax = 1e3; int n,m; vector<int> G[nmax + 5]; int main() { ios::sync_with_stdio(false); cin.tie(0); #ifdef home freopen("nr.in","r",stdin); freopen("nr.out","w",stdout); #endif // home cin>>n>>m; for(int i=1;i<n;i++) { int x,y; cin>>x>>y; G[x].push_back(y); G[y].push_back(x); } if(n > 3) { cout<<"NO"<<'\n'; return 0; } cout<<"YES"<<'\n'; if(n==1) { cout<<"1\n1\n"; return 0; } if(n==2) { cout<<"2"<<'\n'; cout<<"1 1"<<'\n'; return 0; } if(n==3) { cout<<"2"<<'\n'; cout<<"2 2"<<'\n'; return 0; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...