This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
vector<int> adj[200001];
int dp[200001];
int co[200001];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
int aa,bb;
cin>>aa>>bb;
aa--;
bb--;
adj[aa].pb(bb);
adj[bb].pb(aa);
}
if(m!=n-1){
cout<<"NO"<<endl;
}
else{
cout<<"YES"<<endl;
if(n==1){
cout<<1<<endl;
cout<<1<<endl;
return 0;
}
cout<<n<<endl;
for(int i=0;i<n;i++){
if(i==n-1){
cout<<i<<" ";
continue;
}
cout<<i+1<<" ";
}
cout<<endl;
}
/* if(n==1){
cout<<"YES"<<endl;
cout<<"1"<<endl;
cout<<"1"<<endl;
}
else if(n==2){
cout<<"YES"<<endl;
cout<<"2"<<endl;
cout<<"1 1"<<endl;
}
else if(n==3){
cout<<"YES"<<endl;
cout<<"2"<<endl;
cout<<"2 2"<<endl;
}
else{
cout<<"NO"<<endl;
}
*/
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |