| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 717970 | 125259 | Permutation (APIO22_perm) | C++17 | 3 ms | 432 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<long long>num;
void start(){
	long long cnt=1;
	for(int i=0; i<63; i++){
		num.push_back(cnt);
		cnt*=2;
	}
	return;
}
vector<int> construct_permutation(long long k){
	start();
	vector<int>v;
	for(int i=62; i>=0; i--){
		if(k>=num[i]){
			v.push_back(i);
			k-=num[i];
		}
	}
	sort(v.begin(),v.end());
	vector<int>vec;
	int cnt=v.back()+v.size()-2;
	int cnt1=0;
	for(int i=0; i<v.size()-1; i++){
		while(cnt1<v[i]){
			vec.push_back(cnt1);
			cnt1++;
		}
		vec.push_back(cnt); cnt--;
	}
	while(cnt1<v.back()){
		vec.push_back(cnt1); cnt1++;
	}
	
	return vec;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
