Submission #971654

# Submission time Handle Problem Language Result Execution time Memory
971654 2024-04-29T06:44:59 Z idas The Collection Game (BOI21_swaps) C++17
12 / 100
894 ms 6980 KB
//
// --- Sample implementation for the task swaps ---
//
// To compile this program with the sample grader, place:
//     swaps.h swaps_sample.cpp sample_grader.cpp
// in a single folder and run:
//     g++ swaps_sample.cpp sample_grader.cpp
// in this folder.
//
#include <bits/stdc++.h>

using namespace std;

#include "swaps.h"
#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define sz(x) int((x).size())
#define pb push_back
#define s second
#define f first

typedef vector<int> vi;
typedef pair<int, int> pii;

const int NN=510;

bool cmp[NN][NN];

void solve(int n, int v)
{
    set<pii> inf;
    FOR(i, 1, n+1)
    {
        FOR(j, i+1, n+1)
        {
            inf.insert({i,j});
        }
    }

    vi ans(n); FOR(i, 0, n) ans[i]=i+1;

    FOR(i, 0, v)
    {
        set<int> vis;
        set<pii> er;
        vector<pii> ins;
        for(auto it : inf){
            int x=it.f, y=it.s;
            if(!vis.count(x) && !vis.count(y)){
                schedule(x, y);
                vis.insert(x);
                vis.insert(y);
                ins.pb({x,y});
                er.insert(it);
            }
        }

        for(auto it : er) inf.erase(it);

        vi get=visit();
        FOR(j, 0, sz(get))
        {
            int x=ins[j].f, y=ins[j].s; bool val=get[j];

            if(!val){
                swap(ans[x-1], ans[y-1]);
            }

            cmp[x][y]=val;
            cmp[y][x]=!val;
        }
    }

    answer(ans);
}
# Verdict Execution time Memory Grader output
1 Incorrect 18 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 40 ms 600 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 344 KB Correct
2 Correct 40 ms 600 KB Correct
3 Incorrect 22 ms 344 KB Not correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 145 ms 1928 KB Correct
4 Correct 873 ms 6980 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 145 ms 1928 KB Correct
4 Correct 873 ms 6980 KB Correct
5 Incorrect 23 ms 344 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 344 KB Correct
2 Correct 42 ms 600 KB Correct
3 Correct 141 ms 1928 KB Correct
4 Correct 894 ms 6600 KB Correct
5 Incorrect 846 ms 6572 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 344 KB Correct
2 Correct 42 ms 600 KB Correct
3 Correct 141 ms 1928 KB Correct
4 Correct 894 ms 6600 KB Correct
5 Incorrect 846 ms 6572 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 344 KB Correct
2 Correct 32 ms 852 KB Correct
3 Correct 142 ms 1932 KB Correct
4 Correct 884 ms 6724 KB Correct
5 Incorrect 856 ms 6572 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 344 KB Correct
2 Correct 32 ms 852 KB Correct
3 Correct 142 ms 1932 KB Correct
4 Correct 884 ms 6724 KB Correct
5 Incorrect 856 ms 6572 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 344 KB Correct
2 Correct 36 ms 600 KB Correct
3 Correct 144 ms 1932 KB Correct
4 Correct 872 ms 6592 KB Correct
5 Incorrect 846 ms 6824 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 344 KB Correct
2 Correct 36 ms 600 KB Correct
3 Correct 144 ms 1932 KB Correct
4 Correct 872 ms 6592 KB Correct
5 Incorrect 846 ms 6824 KB Not correct
6 Halted 0 ms 0 KB -