Submission #971675

# Submission time Handle Problem Language Result Execution time Memory
971675 2024-04-29T07:26:52 Z idas The Collection Game (BOI21_swaps) C++17
35 / 100
913 ms 6824 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(ans[x-1], ans[y-1]);
                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 Correct 23 ms 344 KB Correct
2 Correct 33 ms 600 KB Correct
3 Correct 143 ms 1880 KB Correct
4 Correct 889 ms 6344 KB Correct
5 Correct 900 ms 6348 KB Correct
6 Correct 888 ms 6348 KB Correct
7 Correct 884 ms 6344 KB Correct
8 Correct 874 ms 6344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 504 KB Correct
2 Correct 29 ms 600 KB Correct
3 Correct 135 ms 1880 KB Correct
4 Correct 884 ms 6332 KB Correct
5 Correct 907 ms 6336 KB Correct
6 Correct 900 ms 6344 KB Correct
7 Correct 887 ms 6348 KB Correct
8 Correct 874 ms 6580 KB Correct
9 Correct 869 ms 6344 KB Correct
10 Correct 852 ms 6348 KB Correct
11 Correct 856 ms 6340 KB Correct
12 Correct 869 ms 6344 KB Correct
13 Correct 852 ms 6488 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 32 ms 344 KB Correct
4 Correct 35 ms 600 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 344 KB Correct
2 Correct 34 ms 760 KB Correct
3 Correct 141 ms 1880 KB Correct
4 Correct 909 ms 6344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 344 KB Correct
2 Correct 34 ms 760 KB Correct
3 Correct 141 ms 1880 KB Correct
4 Correct 909 ms 6344 KB Correct
5 Correct 20 ms 344 KB Correct
6 Correct 31 ms 600 KB Correct
7 Correct 141 ms 1880 KB Correct
8 Correct 871 ms 6344 KB Correct
9 Correct 907 ms 6348 KB Correct
10 Correct 890 ms 6336 KB Correct
11 Correct 879 ms 6572 KB Correct
12 Correct 913 ms 6344 KB Correct
13 Correct 25 ms 344 KB Correct
14 Correct 29 ms 600 KB Correct
15 Correct 138 ms 1876 KB Correct
16 Correct 882 ms 6344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 344 KB Correct
2 Correct 28 ms 600 KB Correct
3 Correct 144 ms 1880 KB Correct
4 Correct 868 ms 6344 KB Correct
5 Incorrect 866 ms 6320 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 27 ms 344 KB Correct
2 Correct 28 ms 600 KB Correct
3 Correct 144 ms 1880 KB Correct
4 Correct 868 ms 6344 KB Correct
5 Incorrect 866 ms 6320 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 344 KB Correct
2 Correct 29 ms 600 KB Correct
3 Correct 143 ms 1880 KB Correct
4 Correct 901 ms 6824 KB Correct
5 Incorrect 841 ms 6324 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 344 KB Correct
2 Correct 29 ms 600 KB Correct
3 Correct 143 ms 1880 KB Correct
4 Correct 901 ms 6824 KB Correct
5 Incorrect 841 ms 6324 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
3 Correct 143 ms 1880 KB Correct
4 Correct 890 ms 6344 KB Correct
5 Incorrect 868 ms 6572 KB Not correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
3 Correct 143 ms 1880 KB Correct
4 Correct 890 ms 6344 KB Correct
5 Incorrect 868 ms 6572 KB Not correct
6 Halted 0 ms 0 KB -