# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1083815 | alexander707070 | Permutation (APIO22_perm) | C++17 | 1 ms | 344 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<bits/stdc++.h>
#define MAXN 200007
using namespace std;
int num;
deque<int> perm;
vector<int> ans,w;
void mult(){
perm.push_back(num);
num++;
}
void add(){
perm.push_front(num);
num++;
}
vector<int> construct_permutation(long long k){
bool fr=false;
for(int i=62;i>=0;i--){
if((1LL<<i)>k)continue;
if(((1LL<<i)&k)>0 and fr){
add();
}else if(((1LL<<i)&k)>0)fr=true;
if(i>0)mult();
}
for(int i=0;i<perm.size();i++){
ans.push_back(perm[i]);
}
return ans;
}
/*int main(){
w=construct_permutation(5);
for(int i:w)cout<<i<<" ";
}*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |