Submission #969562

#TimeUsernameProblemLanguageResultExecution timeMemory
969562SyriusPermutation (APIO22_perm)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h>
#include "perm.h"
using namespace std;
 
// #define int long long
#define ll long long
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL)

const double inf = 1e18 + 9;
const int mxn = 2e5 + 2;
const int mod = 1e9 + 7;
 
vector< int> construct_permutation(long long k) {
    
	vector < int > v;
	int mn = 0 , mx = 0;
	int kk = k;
	while (k != 1) {
		if (k % 2 == 0) k /= 2;
		else k--;
		mx++;
	}

	k = kk;
	while (k != 1) {
		if (k % 2 == 0) {
			k /= 2;
			v.push_back(mx);
			mx--;
		} else {
			k--;
			v.push_back(mn);
		}
	}

	reverse(v.begin() , v.end());
	return v;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...