Submission #658329

#TimeUsernameProblemLanguageResultExecution timeMemory
658329Zena_HossamPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "perm.h" //#include "grader.cpp" #define ll long long using namespace std; std::vector<long long> construct_permutation(long long k) { ll p=k-2;k--; vector<ll>s,x; while(1) { ll l=0,r=60,p1,h; while(l<=r) { ll mid=(l+r)/2; p1=(1<<mid)-1; if(k>=p1) { h=mid; l=mid+1; } else r=mid-1; } for(ll i=p-h+1;i<=p;i++){ s.push_back(i); } // cout<<v[o].first<<" "<<v[o].second<<" "<<k<<"\n"; p-=h; k-=((1<<h)-1); if(k<=0)break; } for(ll i=0;i<s.size();i++) { s[i]-=(p+1); } return s; }

Compilation message (stderr)

perm.cpp:6:24: error: ambiguating new declaration of 'std::vector<long long int> construct_permutation(long long int)'
    6 | std::vector<long long> construct_permutation(long long k)
      |                        ^~~~~~~~~~~~~~~~~~~~~
In file included from perm.cpp:2:
perm.h:3:18: note: old declaration 'std::vector<int> construct_permutation(long long int)'
    3 | std::vector<int> construct_permutation(long long k);
      |                  ^~~~~~~~~~~~~~~~~~~~~
perm.cpp: In function 'std::vector<long long int> construct_permutation(long long int)':
perm.cpp:32:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(ll i=0;i<s.size();i++)
      |                ~^~~~~~~~~