Submission #910679

#TimeUsernameProblemLanguageResultExecution timeMemory
910679efedmrlrPermutation (APIO22_perm)C++17
10 / 100
1 ms348 KiB
#include "perm.h"
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>

using namespace std;


#define lli long long int
#define MP make_pair
#define pb push_back
#define REP(i,n) for(int i = 0; (i) < (n); (i)++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()


void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


const double EPS = 0.00001;
const int INF = 1e9+500;
const int N = 3e5+5;
const int ALPH = 26;
const int LGN = 25;
constexpr int MOD = 1e9+7;
int n,m,q;

std::vector<int> construct_permutation(long long k)
{
	int nxt = 0;
	k--;
	vector<vector<int> > gr(14);
	
	for(int i = 1; i<14; i++) {

		if(i < 7) {
			if(k & (1ll<<i)) {
				for(int j = 0; j < max(1, i); j++) {
					gr[i].pb(nxt); nxt++;
				}
			}
		}
		else {
			if(k & (1ll<<(1ll * (i - 7)))) {
				gr[i].pb(nxt); nxt++;
			}
		}
	}
	vector<int> ret;
	for(int i = 13; i>=0; i--) {
		for(auto c : gr[i]) {
			// cout<<c<<" ";
			ret.pb(c);
		}
	}
	// cout<<endl;
	return ret;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...