# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
744476 | Dan4Life | Permutation (APIO22_perm) | C++17 | 2 ms | 300 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;
#define pb push_back
#define all(a) begin(a), end(a)
vector<int> construct_permutation(ll n)
{
vector<int> ans;
ll xd = 1, p=0;
while(xd*2<=n) xd*=2, p++;
int cnt = 199;
for(int i = 0; i < p; i++){
if(n&(1<<i)) ans.pb(cnt--);
ans.pb(i);
}
vector<int> v;
for(auto u : ans) v.pb(u); sort(all(v));
for(auto &u : ans) u=lower_bound(all(v),u)-begin(v);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |