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;
std::vector<int>construct_permutation(long long k)
{
k--;
vector<int>v;
int x=0,y=999;
while(k>0)
{
if(k&1)
{
v.push_back(y);
y--;k--;
}
else
{
v.push_back(x);
x++;k>>=1;
}
}
map<int,int>mp;
for(int i:v)mp[i];
int cnt=0;
for(auto&[a,b]:mp)b=cnt++;
for(int&i:v)i=mp[i];
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |