This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e3 + 5;
bool vec[nmax];
vector<int> g[nmax];
int main() {
int n, m;
cin >> n >> m;
if(m == n - 1) {
cout << "YES\n1\n1\n";
}
else if(m == n) {
for(int i = 0, x, y; i < m; i++) {
cin >> x >> y;
g[x].push_back(y);
g[y].push_back(x);
}
for(int i = 1; i <= n; i++) {
if(g[i].size() != 2) {
cout << "NO\n";
return 0;
}
}
cout << "NO\n";
}
else
cout << "YES\n1\n1\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |