이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#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;
cout<<1<<endl;
cout<<1<<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... |