Submission #1216293

#TimeUsernameProblemLanguageResultExecution timeMemory
1216293tapilyocaThe Collection Game (BOI21_swaps)C++20
0 / 100
0 ms412 KiB
#include "swaps.h"
#include<bits/stdc++.h>
using namespace std;

template<typename T>
using vec = vector<T>;
using ll = long long;
using vll = vec<ll>;
using pll = pair<ll,ll>;
#define pb push_back;
#define dbg(x) if(1) cerr << #x << ": " << x << endl;

int n;
void sched(int a, int b) {
    if(a >= n or b >= n) return;
    a++;b++;
    // cerr << a << " " << b << endl;
    schedule(a,b);
}

void solve(int N, int V) {
    n = N;
    int nPow = ceil(log2(N));
    int nPad = 1<<nPow;

    for(int i = 1; i <= nPow; i++) {
        int blkSize = (1<<i);

        for(int j = blkSize / 2; j >= 1; j /= 2) {
            for(int k = 0; k < N; k += j * 2) {
                for(int l = 0; l < j; l++) {
                    cerr << j << " " << k << " " << l << endl;
                    if((k/blkSize) % 2 == 0) {
                        sched(k+l,k+l+j);
                    } else {
                        sched(k+l+j,k+l);
                    }
                }
            }
            visit();
        }
    }


    vec<int> ans(N);
    iota(ans.begin(),ans.end(),1);
    answer(ans);
}

/*

8 500
1 2 3 4 5 6 7 8
*/
#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...