Submission #744378

#TimeUsernameProblemLanguageResultExecution timeMemory
744378merlynnPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "perm.h" using namespace std; vector<long long> construct_permutation(long long k) { string bn=""; while(k) { bn+=k%2+'0'; k/=2; } reverse(bn.begin(),bn.end()); vector<long long> ret; int cur=0; for(long long i=1;i<bn.size();i++) { ret.push_back(cur++); if(bn[i]=='1') ret.insert(ret.begin(),cur++); } return ret; }

Compilation message (stderr)

perm.cpp:5:19: error: ambiguating new declaration of 'std::vector<long long int> construct_permutation(long long int)'
    5 | 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:15:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(long long i=1;i<bn.size();i++)
      |                    ~^~~~~~~~~~