Submission #497186

# Submission time Handle Problem Language Result Execution time Memory
497186 2021-12-22T16:00:07 Z Victor Newspapers (CEOI21_newspapers) C++17
6 / 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%2==1)<<endl;
    rep(i,0,n)cout<<i+1<<' ';
    if(n%2==0)cout<<1<<' ';
    rep(i,0,n)cout<<i+1<<' ';

    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 332 KB Provide a successful but not optimal strategy.
3 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
4 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
5 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
6 Partially correct 0 ms 332 KB Failed to provide a successful strategy.
7 Incorrect 1 ms 332 KB Output isn't correct
8 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 332 KB Provide a successful but not optimal strategy.
3 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
4 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
5 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
6 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
7 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
8 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
9 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
10 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
11 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
12 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
13 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
14 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
15 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
16 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
17 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
18 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
19 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
20 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
# 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 332 KB Provide a successful but not optimal strategy.
3 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
4 Partially correct 1 ms 332 KB Provide a successful but not optimal strategy.
5 Partially correct 0 ms 332 KB Provide a successful but not optimal strategy.
6 Partially correct 0 ms 332 KB Failed to provide a successful strategy.
7 Incorrect 1 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -