제출 #698750

#제출 시각아이디문제언어결과실행 시간메모리
698750CyanmondNewspapers (CEOI21_newspapers)C++17
4 / 100
1 ms212 KiB
#include <bits/stdc++.h>

int main() {
    int N, M;
    std::cin >> N >> M;
    std::vector<int> A(M), B(M);
    std::vector<int> deg(N);
    for (int i = 0; i < M; ++i) {
        std::cin >> A[i] >> B[i];
        --A[i], --B[i];
        ++deg[A[i]];
        ++deg[B[i]];
    }
    int u = 0;
    for (auto &e : deg) {
        if (e >= 3) {
            ++u;
        }
    }
    if (M == N - 1 and u <= 1) {
        std::cout << "YES" << std::endl;
    std::cout << 1 << std::endl;
    std::cout << 1 << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...