Submission #1114564

#TimeUsernameProblemLanguageResultExecution timeMemory
1114564vjudge1Newspapers (CEOI21_newspapers)C++17
0 / 100
1 ms336 KiB
//Dost SEFEROĞLU #include <bits/stdc++.h> #pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt") using namespace std; #define int long long #define pii pair<int,int> #define ff first #define ss second #define sp << " " << #define all(cont) cont.begin(),cont.end() #define vi vector<int> const int MOD = 1e9+7,inf = 2e18; const int N = 2e5+50,Q = 2e5+50; const int B = 500; void solve() { int n,m; cin >> n >> m; if (m > n-1) { cout << "NO\n"; return; } vi deg(n+1,0); for (int i=1;i<=m;i++) { int a,b; cin >> a >> b; deg[a]++,deg[b]++; } int cnt = 0,fnd; for (int i=1;i<=n;i++) { if (deg[i] >= 2) { cnt++; fnd = i; } } if (cnt > 1) { cout << "NO\n"; return; } cout << "YES\n"; cout << 2 <<'\n'; cout << fnd << ' ' << fnd << '\n'; } signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #ifdef Dodi freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif int t = 1; //cin >> t; while (t --> 0) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...