#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
504 KB |
Integer 0 violates the range [1, 2] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Integer 0 violates the range [1, 2] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
504 KB |
Integer 0 violates the range [1, 2] |
3 |
Halted |
0 ms |
0 KB |
- |