답안 #1114565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114565 2024-11-19T08:05:28 Z vjudge1 Newspapers (CEOI21_newspapers) C++17
0 / 100
1 ms 336 KB
//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 = 1;
    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();
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 336 KB Provide a successful but not optimal strategy.
2 Correct 1 ms 336 KB Output is correct
3 Incorrect 1 ms 336 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 336 KB Provide a successful but not optimal strategy.
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Incorrect 1 ms 336 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 336 KB Provide a successful but not optimal strategy.
2 Correct 1 ms 336 KB Output is correct
3 Incorrect 1 ms 336 KB Output isn't correct
4 Halted 0 ms 0 KB -