Submission #744847

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

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:14:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i=1;i<bn.size();i++)
      |              ~^~~~~~~~~~
/usr/bin/ld: /tmp/ccT7fM5Z.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccZsKs3Z.o:perm.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status