# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1185239 | cpdreamer | Newspapers (CEOI21_newspapers) | C++20 | 1 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair
#define F first
#define all(v) v.begin(),v.end()
#define V vector
#define pb push_back
#define S second
void file() {
freopen("input.txt.txt", "r", stdin);
freopen("output.txt.txt", "w", stdout);
}
V<int>binary_rep(int n){
V<int>vp;
for(int i=0;i<30;i++){
if(((1<<i)&n)!=0)
vp.pb(1);
else
vp.pb(0);
}
return vp;
}
void solve() {
int n;
cin>>n;
int m;
cin>>m;
V<int>adj[n+1];
for(int i=0;i<m;i++){
int a,b;
cin>>a>>b;
adj[a].pb(b);
adj[b].pb(a);
}
if(m!=n-1){
cout<<"NO"<<endl;
return;
}
for(int i=1;i<=n;i++){
if((int)adj[i].size()>=3){
cout<<"NO"<<endl;
return;
}
}
cout<<"YES"<<endl;
cout<<1<<endl;
cout<<1<<endl;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//file();
solve();
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |