Submission #1191177

#TimeUsernameProblemLanguageResultExecution timeMemory
1191177GrayNewspapers (CEOI21_newspapers)C++20
4 / 100
1 ms328 KiB
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define ff first
#define ss second
#define ln "\n"
#define mp make_pair
#define pb push_back
#define INF (ll)1e18
ll MOD = (ll)(1e9+7);

void solve(){
    ll n, m; cin >> n >> m;
    if (n==1){
        cout << "YES\n1\n1\n"; return;
    }else if (n==2){
        ll _; cin >> _ >> _;
        cout << "YES\n2\n1 1\n"; return;
    }
    for (ll i=0; i<m; i++){
        ll u, v; cin >> u >> v;
    }
    cout << "YES" << ln;
    cout << (n-2)*2 << ln;
    for (ll i=2; i<=n-1; i++){
        cout << i << " " << i << " ";
    }
    cout << ln;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    #ifdef LOCAL
    auto start = chrono::high_resolution_clock::now();
    #endif
    ll testc=1;
    // cin >> testc;
    for (ll __c=1; __c<=testc; __c++) solve();
    #ifdef LOCAL
    auto duration = chrono::duration_cast<chrono::microseconds>(chrono::high_resolution_clock::now() - start);
    cout << setprecision(0) << fixed << "time: " << (double)duration.count()/1000.0 << " milliseconds" << endl;
    #endif
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...