Submission #741930

#TimeUsernameProblemLanguageResultExecution timeMemory
741930t6twotwoPermutation (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> construct_permutation(ll k) {
	int p = 63 - __builtin_clzll(k);
	int v = __builtin_popcountll(k) - 1;
	int u = v;
	vector<int> ans;
	for (int i = p - 1; i >= 0; i--) {
		ans.push_back(u++);
		if (k >> i & 1) {
			ans.push_back(--v);
		}
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...