제출 #1206133

#제출 시각아이디문제언어결과실행 시간메모리
1206133jer033The Collection Game (BOI21_swaps)C++20
51 / 100
2 ms532 KiB
#include "swaps.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;



vector<vector<pii>> comparisons;

void call_in(int i, int j, int round)
{
    //cout << "calling in " << i << ' ' << j << ' ' << round << '\n';
    comparisons[round].push_back({i, j});
}

void group_call_in(int i, int j, int round)
{
    if (i!=j)
    {
        int mid = (i+j)/2;
        int diff = mid-i+1;
        for (int k=i; k<=mid; k++)
            call_in(k, k+diff, round);
        if ((j-i)>1)
        {
            group_call_in(i, mid, round+1);
            group_call_in(mid+1, j, round+1);
        }
    }
}

void sortpow2(int lo, int hi, int major_round)
{
    int mid = (lo+hi)/2;
    if ((hi-lo)>1)
    {
        sortpow2(lo, mid, major_round-1);
        sortpow2(mid+1, hi, major_round-1);
    }
    int first_round_in_major_round = ((major_round-1)*(major_round))/2;
    for (int i=lo; i<=mid; i++)
        call_in(i, lo+hi-i, first_round_in_major_round);
    group_call_in(lo, mid, first_round_in_major_round+1);
    group_call_in(mid+1, hi, first_round_in_major_round+1);
}

void init()
{
    int K = 512;
    comparisons = vector<vector<pii>> (45);
    sortpow2(1, 512, 9);
}

void solve(int N, int V) {
    init();

    for (int i=0; i<45; i++)
    {
        for (pii x: comparisons[i])
        {
            int x1 = x.first;
            int x2 = x.second;
            if ((x1<=N) and (x2<=N))
                schedule(x.first, x.second);
        }
        visit();
    }
    vector<int> beauty;
    for (int i=1; i<=N; i++)
        beauty.push_back(i);
    answer(beauty);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...