Submission #1264478

#TimeUsernameProblemLanguageResultExecution timeMemory
1264478XXBabaProBerkayPermutation (APIO22_perm)C++17
91.33 / 100
1 ms328 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 - 1;

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