답안 #971736

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
971736 2024-04-29T08:23:44 Z idas The Collection Game (BOI21_swaps) C++17
35 / 100
930 ms 12728 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;

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);

        if(i==v-1) assert(inf.empty());

        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]);
            }
        }
    }

    answer(ans);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 344 KB Correct
2 Correct 29 ms 600 KB Correct
3 Correct 153 ms 1880 KB Correct
4 Correct 908 ms 6560 KB Correct
5 Correct 909 ms 6308 KB Correct
6 Correct 914 ms 6336 KB Correct
7 Correct 916 ms 6336 KB Correct
8 Correct 907 ms 6332 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 144 ms 1880 KB Correct
4 Correct 910 ms 6340 KB Correct
5 Correct 917 ms 6336 KB Correct
6 Correct 894 ms 6560 KB Correct
7 Correct 893 ms 6336 KB Correct
8 Correct 903 ms 6308 KB Correct
9 Correct 887 ms 6340 KB Correct
10 Correct 888 ms 6336 KB Correct
11 Correct 892 ms 6568 KB Correct
12 Correct 887 ms 6336 KB Correct
13 Correct 889 ms 6336 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 344 KB Correct
2 Correct 31 ms 600 KB Correct
3 Correct 26 ms 344 KB Correct
4 Correct 32 ms 600 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 344 KB Correct
2 Correct 29 ms 852 KB Correct
3 Correct 146 ms 1880 KB Correct
4 Correct 919 ms 6336 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 344 KB Correct
2 Correct 29 ms 852 KB Correct
3 Correct 146 ms 1880 KB Correct
4 Correct 919 ms 6336 KB Correct
5 Correct 25 ms 344 KB Correct
6 Correct 37 ms 600 KB Correct
7 Correct 147 ms 1880 KB Correct
8 Correct 918 ms 6560 KB Correct
9 Correct 930 ms 6340 KB Correct
10 Correct 903 ms 6564 KB Correct
11 Correct 905 ms 6336 KB Correct
12 Correct 903 ms 6564 KB Correct
13 Correct 25 ms 344 KB Correct
14 Correct 42 ms 600 KB Correct
15 Correct 144 ms 1876 KB Correct
16 Correct 912 ms 6332 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 140 ms 1880 KB Correct
4 Correct 906 ms 6820 KB Correct
5 Runtime error 898 ms 12728 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 140 ms 1880 KB Correct
4 Correct 906 ms 6820 KB Correct
5 Runtime error 898 ms 12728 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 155 ms 1880 KB Correct
4 Correct 904 ms 6336 KB Correct
5 Runtime error 903 ms 12452 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 155 ms 1880 KB Correct
4 Correct 904 ms 6336 KB Correct
5 Runtime error 903 ms 12452 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 142 ms 1880 KB Correct
4 Correct 913 ms 6336 KB Correct
5 Runtime error 895 ms 12456 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 344 KB Correct
2 Correct 32 ms 600 KB Correct
3 Correct 142 ms 1880 KB Correct
4 Correct 913 ms 6336 KB Correct
5 Runtime error 895 ms 12456 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -