#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<vector<int>> adj(n);
for (int i = 0; i < m; i++) {
int u, v;
cin >> u >> v;
u--;
v--;
adj[u].push_back(v);
adj[v].push_back(u);
}
if (m != n - 1) {
cout << "NO\n";
return 0;
}
cout << "YES\n";
cout << "1\n1\n";
// if (n >= 5) {
// cout << "NO\n";
// } else if (n == 4) {
// cout << "YES\n";
// cout << "5\n";
// cout << "2 2 3 3 2\n";
// } else if (n == 2 || n == 3) {
// cout << "YES\n";
// cout << "2\n2 2\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... |