Submission #478606

# Submission time Handle Problem Language Result Execution time Memory
478606 2021-10-08T05:22:41 Z Haruto810198 The Collection Game (BOI21_swaps) C++17
15 / 100
70 ms 1312 KB
#include <bits/stdc++.h>
#include "swaps.h"

using namespace std;

//#define int long long
#define double long double

#define FOR(i, l, r, d) for(int i=(l); i<=(r); i+=(d))
#define szof(x) ((int)(x).size())

#define vi vector<int>
#define pii pair<int, int>

#define F first
#define S second

#define pb push_back
#define eb emplace_back
#define mkp make_pair

const int INF = 2147483647;
//const int LNF = INF*INF;
const int MOD = 1000000007;
const int mod = 998244353;
const double eps = 1e-12;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

int gr[501][501];
bool vis[501];

bool cmp(int a, int b){
    return gr[a][b];
}

void solve(int N, int V){

    FOR(dis, 1, N-1, 1){

        FOR(i, 1, N, 1){
            vis[i] = 0;
        }

        vector<pii> qu1, qu2;

        FOR(L, 1, N-dis, 1){
            int R = L + dis;
            if(vis[L] == 0 and vis[R] == 0){
                vis[L] = vis[R] = 1;
                qu1.eb(L, R);
            }
            else{
                qu2.eb(L, R);
            }
        }

        for(pii i : qu1){
            schedule(i.F, i.S);
        }
        vi ans = visit();
        FOR(i, 0, szof(qu1) - 1, 1){
            gr[qu1[i].F][qu1[i].S] = ans[i];
            gr[qu1[i].S][qu1[i].F] = ans[i] ^ 1;
        }

        for(pii i : qu2){
            schedule(i.F, i.S);
        }
        ans = visit();
        FOR(i, 0, szof(qu2) - 1, 1){
            gr[qu2[i].F][qu2[i].S] = ans[i];
            gr[qu2[i].S][qu2[i].F] = ans[i] ^ 1;
        }

    }

    vi res;
    FOR(i, 1, N, 1){
        res.pb(i);
    }

    /*
    FOR(i, 1, N, 1){
        FOR(j, 1, N, 1){
            cerr<<gr[i][j]<<" ";
        }
        cerr<<endl;
    }
    cerr<<endl;
    */

    sort(res.begin(), res.end(), cmp);

    answer(res);

}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 5 ms 456 KB Correct
3 Correct 15 ms 912 KB Correct
4 Correct 59 ms 1296 KB Correct
5 Correct 55 ms 1292 KB Correct
6 Correct 54 ms 1292 KB Correct
7 Correct 65 ms 1292 KB Correct
8 Correct 61 ms 1292 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 200 KB Correct
2 Correct 4 ms 456 KB Correct
3 Correct 17 ms 800 KB Correct
4 Correct 56 ms 1312 KB Correct
5 Correct 70 ms 1296 KB Correct
6 Correct 59 ms 1292 KB Correct
7 Correct 58 ms 1296 KB Correct
8 Correct 53 ms 1300 KB Correct
9 Correct 51 ms 1292 KB Correct
10 Correct 69 ms 1304 KB Correct
11 Correct 52 ms 1296 KB Correct
12 Correct 57 ms 1292 KB Correct
13 Correct 56 ms 1296 KB Correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 300 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Not correct
2 Halted 0 ms 0 KB -