# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
746970 | snpmrnhlol | Permutation (APIO22_perm) | C++17 | 3 ms | 428 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;
typedef long long ll;
vector <int> v;
map <ll,ll> f;
std::vector<int> construct_permutation(ll k)
{
v.clear();
ll i,j,cnt = 0;
i = j = 0;
while(k > 1){
if(k%2 == 1){
v.push_back(1000 - j++);
}
v.push_back(i++);
k/=2;
}
f.clear();
ll cnt2 = 0;
//for(auto i:v)cout<<i<<' ';
for(auto i:v)f[i] = 1;
for(auto &i:f)i.second = cnt2++;//,cout<<i.first<<' ';
for(auto &i:v)i = f[i];
//for(auto i:v)cout<<i<<' ';
return v;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |