# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1049174 | Maite_Morale | Permutation (APIO22_perm) | C++17 | 1 ms | 348 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>
using namespace std;
typedef long long ll;
#define vll vector<ll>
std::vector<int> construct_permutation(long long k){
vll r;ll b=0;ll c=0,d=0;
vector<int> ans={};
for(int i=60;i>=0;i--){
if(b==1){
r.push_back(c);c++;
if(k&(1LL<<i)){
d--;
r.push_back(d);
}
}
if(k&(1LL<<i)){
b=1;//cout<<i<<"*-*";
}
}
for(int i=0;i<r.size();i++){
ans.push_back(r[i]-d);
//cout<<ans.back()<<" ";
}//cout<<"\n";
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |