Submission #601905

#TimeUsernameProblemLanguageResultExecution timeMemory
601905patrikpavic2순열 (APIO22_perm)C++17
91.33 / 100
3 ms340 KiB
#include "perm.h"
#include <vector>
#include <algorithm>

#define PB push_back

using namespace std;

typedef vector < int > vi;
typedef long long ll;

vi construct_permutation(long long k){
	k--;
	if(k == 0) return {};
	if(k == 1) return {0};
	if(k == 2) return {1, 0};
	vi st = construct_permutation((k - 1) / 2 + 1);
	st.PB((int)st.size());
	if(!(k & 1)){
		for(int& x : st) x++;
		st.PB(0);
	}
	return st;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...