제출 #744847

#제출 시각아이디문제언어결과실행 시간메모리
744847merlynn순열 (APIO22_perm)C++17
컴파일 에러
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; }

컴파일 시 표준 에러 (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