Submission #1112188

#TimeUsernameProblemLanguageResultExecution timeMemory
1112188mariaclaraPermutation (APIO22_perm)C++17
91.33 / 100
2 ms504 KiB
#include "perm.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 5e3 + 5;
#define all(x) x.begin(), x.end();
#define sz(x) (int)x.size()
#define mk make_pair 
#define pb push_back 
#define fr first 
#define sc second 

vector<int> construct_permutation(ll k){
	vector<int> v;

	for(ll i = 0, val = 2; val <= k; val *= 2, i++) v.pb(i);
	k -= (1LL << sz(v));
	
	for(ll i = 60; i >= 0; i--) {
		if((1LL << i) <= k) {
			k -= (1LL << i);
			v.insert(v.begin() + i, sz(v));
		}
	}
	
	return v;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...