제출 #797185

#제출 시각아이디문제언어결과실행 시간메모리
797185JohannNewspapers (CEOI21_newspapers)C++14
8 / 100
1 ms340 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...