Submission #1114528

#TimeUsernameProblemLanguageResultExecution timeMemory
1114528vjudge1Newspapers (CEOI21_newspapers)C++17
0 / 100
1 ms512 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pb push_back using pii=pair<int,int>; signed main(){ int n,m; cin>>n>>m; if(n==1){ cout<<"YES\n1\n1"; return 0; } vector<int>v[n+1]; for(int i=0;i<m;i++){ int x,y; cin>>x>>y; v[x].pb(y); v[y].pb(x); } int guy=0; for(int i=1;i<=n;i++){ if(v[i].size()>1){ if(guy){ cout<<"NO\n"; return 0; } guy=i; } } cout<<"YES\n2\n"<<guy<<' '<<guy; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...