# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
573687 | Jomnoi | Permutation (APIO22_perm) | C++17 | 3 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "perm.h"
using namespace std;
vector <int> construct_permutation(long long k) {
deque <int> p;
vector <int> binary;
while(k > 0) {
binary.push_back(k % 2);
k /= 2;
}
reverse(binary.begin(), binary.end());
int n = 0;
for(int i = 1; i < binary.size(); i++) {
p.push_back(n++);
if(binary[i] == 1) {
p.push_front(n++);
}
}
return vector <int> (p.begin(), p.end());
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |