Submission #852798

#TimeUsernameProblemLanguageResultExecution timeMemory
852798adhityamvPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long vector<int> construct_permutation(ll k){ ll pow2[60]; pow2[0]=1LL; for(int i=1;i<60;i++) pow2[i]=2LL*pow2[i-1]; vector<int> bnry; int e=59; while(pow2[e]>k) e--; while(e>=0){ if(k>=pow2[e]){ k-=pow2[e]; bnry.push_back(1); } else bnry.push_back(0); e--; } int mn=-1; int mx=0; vector<int> ans; int m=(int) bnry.size(); for(int i=1;i<m;i++){ if(bnry[i]==0){ ans.push_back(mx); mx++; } else{ ans.push_back(mx); mx++; ans.push_back(mn); mn--; } } int l=ans.size(); for(int i=0;i<l;i++){ ans[i]-=(mn+1); } return ans; } int main(){ auto v=construct_permutation(23); for(int a:v) cout << a << " "; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cczuoY2O.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cctFLWsP.o:perm.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status