# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
744689 | josanneo22 | 순열 (APIO22_perm) | C++17 | 2 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<unordered_map>
#include<unordered_set>
#include<algorithm>
using namespace std;
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#include <vector>
std::vector<int> construct_permutation(long long k);
std::vector<int> construct_permutation(long long k)
{
int bt = 0;
while ((1LL<<bt) <= k) bt++;
bt--;
std::vector<int> a(bt, -1);
for (int i = bt - 1; i >= 0;i--) {
if ((1LL << i) & k) {
a[i] = bt++;
}
}
std::vector<int> ans;
for (int i = 0; i < a.size(); i++) {
if(a[i]!=-1) ans.push_back(a[i]);
ans.push_back(i);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |