# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
982326 | nnin | Permutation (APIO22_perm) | C++17 | 2 ms | 348 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 "perm.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> construct_permutation(long long k)
{
int g = __lg(k);
vector<int> ans;
int cur = 0;
while(cur<g) {
ans.push_back(cur++);
}
for(int i=g-1;i>=0;i--) {
if(k & (1ll<<i)) {
for(int j=0;j<ans.size();j++) if(ans[j]>=i) ans[j]++;
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... |