Submission #980629

#TimeUsernameProblemLanguageResultExecution timeMemory
980629NexusPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const ll N=1e6+9,M=2e18+9,mod=1e9+7; ll a[66],q,k,x,y,z; vector<int>v; ll po(ll X,ll Y) { if(!Y)return 1; if(Y&1)return X*po(X,Y-1); ll ret=po(X,Y/2); return ret*ret; } ll log2(ll k) { ll g=0; while(k>1)k/=2,++g; return g; } vector<int>construct_permutation(ll k) { x=log2(k); v.clear(); y=x-1; k-=po(2,x); for(ll i=62;i>=0;--i) { if(k>=po(2,i))k-=po(2,i),a[i]=1,++y;else a[i]=0; } for(ll i=0;i<x;++i) { if(a[i])v.push_back(y),--y; v.push_back(i); } return v; } int main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin>>q; while(q--) { cin>>k; vector<int>g=construct_permutation(k); for(auto i:g)cout<<i<<' '; cout<<'\n'; } }

Compilation message (stderr)

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