Submission #497185

# Submission time Handle Problem Language Result Execution time Memory
497185 2021-12-22T15:58:41 Z Victor Newspapers (CEOI21_newspapers) C++17
0 / 100
1 ms 332 KB
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize ("Ofast,inline") // O1 - O2 - O3 - Os - Ofast
// #pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define per(i, a, b) for (int i = (b - 1); i >= (a); --i)
#define trav(a, x) for (auto &a : x)

#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define pb push_back
#define debug(x) cout << #x << " = " << x << endl

#define umap unordered_map
#define uset unordered_set

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;

const int INF = 1'000'000'007;

int n, m;
vi ans, graph[1001];
int parity[1001], cnt[1001];
bitset<1001> removed;

void dfs(int u, int p, int c) {
    parity[u] = c;
    trav(v, graph[u]) if (v != p) dfs(v, u, c ^ 1);
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    cin>>n;

    /*memset(parity, -1, sizeof(parity));
    cin >> n >> m;
    if(m>=n){
        cout<<"NO"<<endl;
        return 0;
    }

    rep(i, 0, m) {
        int u, v;
        cin >> u >> v;
        graph[--u].pb(--v);
        graph[v].pb(u);
    }

    dfs(0, 0, 0);
    bool moves = 0;
    while (1) {
        if (sz(ans) > 5 * n) break;
        int need = 0, node;
        bool stop=1;
        memset(cnt, 0, sizeof(cnt));

        rep(u, 0, n) if (moves == parity[u] && !removed[u]) {
            stop=0;
            bool adj_rem = 0;
            trav(v, graph[u]) {
                ++cnt[v];
                if (removed[v]) adj_rem = 1;
            }
            need += adj_rem;
            if (need) node = u;
        }

        if(stop)break;

        if (need > 1) {
            cout << "YES\n1\n1" << endl;
            return 0;
        }

        if (!need) {
            int mx_rem = -1;
            rep(u, 0, n) if (moves == parity[u] && !removed[u]) {
                int cur_rem = 0;
                trav(v, graph[u]) if (cnt[v] == 1)++ cur_rem;
                if (cur_rem > mx_rem) {
                    mx_rem = cur_rem;
                    node = u;
                }
            }
        }

        //cout<<"moves = "<<moves<<" node = "<<node<<endl;
        ans.pb(node);
        trav(v, graph[node])-- cnt[v];
        moves ^= 1;
        rep(u, 0, n) if (parity[u] == moves && !cnt[u]) removed[u] = 1;
    }

    if (sz(ans) > 5 * n)
        cout << "YES\n1\n1" << endl;

    else {
        cout << "YES\n"
             << 2 * sz(ans) + 1 - moves<<endl;
        trav(pos,ans)cout<<pos+1<<' ';
        if(!moves)cout<<"1 ";
        trav(pos,ans)cout<<pos+1<<' ';
        cout<<endl;
    }*/

    cout<<"YES"<<endl;
    cout<<n*2+1-(n==1)<<endl;
    rep(i,0,n)cout<<i+1<<endl;
    if(n%2==0)cout<<1<<endl;
    rep(i,0,n)cout<<i+1<<endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
2 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
3 Incorrect 0 ms 332 KB Unexpected end of file - int32 expected
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
2 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
3 Incorrect 0 ms 332 KB Unexpected end of file - int32 expected
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
2 Partially correct 0 ms 204 KB Provide a successful but not optimal strategy.
3 Incorrect 0 ms 332 KB Unexpected end of file - int32 expected
4 Halted 0 ms 0 KB -