제출 #1086880

#제출 시각아이디문제언어결과실행 시간메모리
1086880Timosh순열 (APIO22_perm)C++17
0 / 100
0 ms348 KiB
#include "bits/stdc++.h"
#include "perm.h"
using namespace std;
 
std::vector<int> construct_permutation(long long k)
{
	int mx = 10000;
	int mn = 0;
	vector<int> cur;
	long long x = k - 1;
	while (x > 0)
	{
		if (x % 2)
		{
			x--;
			cur.push_back(mx--);
		}
		else
			x /= 2, cur.push_back(mn++);
	}
	reverse(cur.begin(), cur.end());
	for (auto &i : cur)
	{
		if (i > 1000)
			i -= 10000 - (int)cur.size() + 1;
	}
	return cur;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...