Submission #984103

#TimeUsernameProblemLanguageResultExecution timeMemory
984103vjudge1Permutation (APIO22_perm)C++17
64.62 / 100
11 ms1524 KiB
#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<int> construct_permutation(long long k)
{
	k--;
	vector<int> v;
	deque<int> tmp;
	int now = -1;
	for (ll i = 0; i <= 60; i++) {
		if ((1ll << i) & k) {
			deque<int> h;
			h.push_back(now + i + 1);
			for (int j = 0; j < i; j++) {
				// now++;
				h.push_front(++now);
			}
			now++;
			for (auto j : h)
				tmp.push_front(j);
		}
	}
	for (auto it : tmp) {
		// cout << it << " ";
		v.push_back(it);
	}
	// cout << "\n";
	return v;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...