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;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
int N, M;
vvi adj;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N >> M;
if (M > N - 1)
{
cout << "NO\n";
return 0;
}
adj.resize(N);
for (int i = 0, a, b; i < M; ++i)
{
cin >> a >> b;
--a, --b;
adj[a].push_back(b), adj[b].push_back(a);
}
cout << "YES\n";
vi ans;
if (N > 2)
{
for (int i = 1; i < N - 1; ++i)
ans.push_back(i);
for (int i = N - 2; i > 0; --i)
ans.push_back(i);
}
else
{
for (int i = 0; i < N; ++i)
ans.push_back(0);
}
cout << sz(ans) << '\n';
for (int x : ans)
cout << x + 1 << " ";
cout << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |