제출 #911482

#제출 시각아이디문제언어결과실행 시간메모리
911482weakweakweak순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define fs first #define sc second #define pii pair<int,int> vector<int> main(int n){ vector<int>v; int dd=1; while(dd*2<=n){ v.push_back(v.size()+1); dd*=2; } int id=0, zz=10000; n-=dd; int z=v.size(); id=-1; for(int i=0, dd=1; i<=z; i++, zz--, dd*=2){ while(i!=0 and v[id]!=i and id+1<=v.size())id++; if(n&dd){ // cout << i << ' ' << id << ' ' << v[id] << '\n'; v.insert(v.begin()+id+1,zz); } if(i==0)id=0; } return v; }

컴파일 시 표준 에러 (stderr) 메시지

perm.cpp:9:1: error: '::main' must return 'int'
    9 | vector<int> main(int n){
      | ^~~~~~~~~~~
perm.cpp:9:13: warning: first argument of 'int main(long long int)' should be 'int' [-Wmain]
    9 | vector<int> main(int n){
      |             ^~~~
perm.cpp:9:13: warning: 'int main(long long int)' takes only zero or two arguments [-Wmain]
perm.cpp: In function 'int main(long long int)':
perm.cpp:22:45: 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]
   22 |             while(i!=0 and v[id]!=i and id+1<=v.size())id++;
      |                                         ~~~~^~~~~~~~~~
perm.cpp:29:16: error: cannot convert 'std::vector<long long int>' to 'int' in return
   29 |         return v;
      |                ^