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>
#include "perm.h"
using namespace std;
#define endl '\n'
#define pb push_back
bool flag=1;
int a[300];
vector<int> construct_permutation(long long k)
{
long long cnt=1,f=0;
for(long long i=62;i>=0;i--){
if((k>>i)&1){
if(cnt==1){
for(int j=1;cnt<=i;j+=2){
a[j]=cnt++;
a[j]+=200;
}
f=2;
continue;
}
else{
a[f]=-1;
}
f+=2;
}
}
vector<int> v;
int s=1;
for(int i=299;i>=0;i--){
if(a[i]==-1)a[i]=s++;
}
for(int i=0;i<300;i++){
if(a[i]!=0){
if(a[i]>=200){
a[i]=a[i]-200+s-1;
}
v.pb(a[i]-1);
}
}
if(v.size()>3)exit(1);
return v;
}
/*signed main()
{
vector<int> v=construct_permutation(8);
for(auto i:v)cout<<i<<' ';
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |