제출 #767157

#제출 시각아이디문제언어결과실행 시간메모리
767157Ahmed57순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int[] construct_permutation(long long k){ k--; vector<long long> v; for(long long i = 0;i<60;i++){ if((1LL<<i)<=k){ k-=(1LL<<i); v.push_back(i); } } for(long long i = 59;i>=0;i--){ while((1LL<<i)<=k){ long long xd = i; for(int j = v.size()-1;j>=xd;j--){ v[j]++; } v.push_back(i); n-=(1LL<<i); } } int arr[v.size()]; for(int i = 0;i<v.size();i++)arr[i] = v[i]; return arr; }

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

perm.cpp:4:4: error: structured binding declaration cannot have type 'int'
    4 | int[] construct_permutation(long long k){
      |    ^~
perm.cpp:4:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
perm.cpp:4:4: error: empty structured binding declaration
perm.cpp:4:7: error: expected initializer before 'construct_permutation'
    4 | int[] construct_permutation(long long k){
      |       ^~~~~~~~~~~~~~~~~~~~~