제출 #1060962

#제출 시각아이디문제언어결과실행 시간메모리
1060962Muhammet순열 (APIO22_perm)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h>
#include "perm.h"

using namespace std;

#define ll long long
#define sz(s) (int)s.size()

vector<int> construct_permutation(ll k){
	int x = 0;
	deque <int> v2;
	bool tr = 0;
	while(k > 0){
		vector <int> v1;
		ll k1 = 1;
		if(tr == 0) k1 += 1;
		tr = 1;
		v1.push_back(x);
		while(k1 < k){
			if(k/2 < k1) break;
			x++;
			v1.push_back(x);
			k1 *= 2;
		}
		k -= k1;
		for(int i = sz(v1)-1; i >= 0; i--){
			v2.push_front(v1[i]);
		}
	}
	vector <int> v;
	for(int i = 0; i < sz(v2); i++){
		v.push_back(v2[i]);
	}
	return v;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...