#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) (x).begin(), (x).end()
const int N = 1007;
int n, m;
vector<int> adj[N];
int main() {
cin.tie(0)->sync_with_stdio(false);
cin >> n >> m;
for (int i = 1; i <= m; i++) {
int u, v;
cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
if (m != n - 1) {
cout << "NO" << '\n';
return 0;
}
if (n == 2)
cout << "YES" << '\n' << 2 << '\n' << 1 << ' ' << 1 << '\n';
else {
cout << "YES" << '\n' << 2 * (n - 2) << '\n';
for (int i = 2; i <= n - 1; i++)
cout << i << ' ';
for (int i = n - 1; i >= 2; i--)
cout << i << ' ';
cout << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Integer parameter [name=k] equals to -2, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Integer parameter [name=k] equals to -2, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Integer parameter [name=k] equals to -2, violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |