Submission #1097493

#TimeUsernameProblemLanguageResultExecution timeMemory
1097493alexander707070Newspapers (CEOI21_newspapers)C++14
4 / 100
8 ms14680 KiB
#include<bits/stdc++.h> #define MAXN 600007 using namespace std; int n,m,a,b; vector<int> v[MAXN]; int main(){ cin>>n>>m; for(int i=1;i<=m;i++){ cin>>a>>b; v[a].push_back(b); v[b].push_back(a); } if(m>n-1){ cout<<"NO\n"; return 0; } for(int i=1;i<=n;i++){ if(v[i].size()<=2)continue; int br=0; for(int f:v[i]){ if(v[f].size()>1)br++; } if(br>2){ cout<<"NO\n"; return 0; } } cout<<"YES\n1\n1\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...