Submission #725005

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7250052023-04-16 12:47:54hollwo_pelwPermutation (APIO22_perm)C++17
0 / 100
1 ms284 KiB
#include "perm.h"
// #include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k) {
if (k == 1) return {};
if (k == 2) return {0};
if (k == 3) return {1, 0};
vector<int> bits;
for (; k; k /= 4)
bits.push_back(k % 4);
bool have3 = 0;
int used_for_3 = 0;
vector<int> p;
if (bits.back() == 1) {
p = {};
} else if (bits.back() == 2) {
p = {0};
} else { // == 3
have3 = 1;
p.push_back(-1e9);
p.push_back(-1e9-1);
}
bits.pop_back();
reverse(bits.begin(), bits.end());
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...