# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
574162 | Lawliet | Permutation (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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k)
{
int mn = 0;
vector<int> ans;
while( k > 1 )
{
if( k & 1 )
ans.push_back( mn++ ), k ^= 1;
else
ans.push_back( -1 ), k >>= 1;
}
int mx = (int)ans.size() - 1;
for(int i = 0 ; i < ans.size() ; i++)
if( ans[i] == -1 ) ans[i] = mx--;
reverse( ans.begin() , ans.end() );
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |