Submission #1350589

#TimeUsernameProblemLanguageResultExecution timeMemory
1350589zoharnPermutation (APIO22_perm)C++20
10 / 100
43 ms12332 KiB
using namespace std;
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include "perm.h"
typedef long long ll;

std::vector<int> construct_permutation(long long k)
{
	vector<int> ans1, ans2, ans;
	ll m = floor(log2(k));
	int n = k - (pow(2, m));
	for(int j = 0; j < n; j++) ans2.push_back(j+m);
	reverse(ans2.begin(), ans2.end());
	for(int d = 0; d < m; d++) ans2.push_back(d);
	return ans2;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...