Submission #912428

#TimeUsernameProblemLanguageResultExecution timeMemory
912428XXBabaProBerkayPermutation (APIO22_perm)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second

using ll = long long;

const int INF = 1e9 + 7;
const int MOD = 998244353;

vector<int> construct_permutation(ll k)
{		
	vector<int> ans;
	int a = 0, b = -1;

	bool o = 0;
	for (int i = 63; i >= 0; i--)
	{
		if ((k & (1ll << i)) && !o)
		{
			o = 1;
			continue;
		}

		if (!o)
			continue;

		ans.push_back(a);
		a++;

		if (k & (1ll << i))
		{
			ans.push_back(b);
			b--;
		}
	}

	for (int &i : ans)
		i += -b;

	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...