제출 #724855

#제출 시각아이디문제언어결과실행 시간메모리
724855Batorgil952순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
std::vector<int> construct_permutation(long long k) { long long p=2, s=1, r=0; while(k>p){ p*=2; s++; } s--; vector< int > v; long long a[100], dp[100]; while(r==0){ v.clear(); a[0]=0; for(long long i=0; i<s; i++){ a[i+1]=i; } long long ind=0; do{ for(long long i=0; i<=s; i++){ dp[i]=0; } long long ss=0; dp[0]=1; for(long long i=1; i<=s; i++){ for(long long j=0; j<=i-1; j++){ if(a[j]<=a[i]) dp[i]+=dp[j]; } } for(long long i=0; i<=s; i++){ ss+=dp[i]; } if(ss==k){ ind++; break; } }while(next_permutation(a+1, a+s+1)); if(ind==0) s++; else{ r++; } } for(long long i=1; i<=s; i++){ v.push_back(a[i]); } return v; }

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

perm.cpp:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<int> construct_permutation(long long k)
      |      ^~~~~~
perm.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | std::vector<int> construct_permutation(long long k)