This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |