Submission #1356230

#TimeUsernameProblemLanguageResultExecution timeMemory
1356230nathlol2Permutation (APIO22_perm)C++20
91.33 / 100
1 ms348 KiB
#include "perm.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;

vector<int> construct_permutation(ll k){
	vector<int> ans;
	ll c = 1;
	int cc = 0;
	while(c * 2 <= k){
		ans.push_back(cc++);
		c *= 2;
	}
	k -= c;
	for(ll b = 60;b>=0;b--){
		if(k & (1LL << b)){
			ans.push_back(ans[b]);
			for(int i = b;i<cc;i++) ans[i]++;
			++cc;
		}
	}
	return ans;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...