제출 #738744

#제출 시각아이디문제언어결과실행 시간메모리
738744shantol순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include "perm.h"
#include<bits/stdc++.h>

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long;

int* construct_permutation(ll k){
    vector<int> ans;
    k--;
    for(ll p=1, i=0;p<=k;i++,p=(p<<1)|1){
        ans.pb(i);
    }
    ll p=ans.sz;
    vector<vector<int>> v(p+1);
    k=k-(1<<p)+1;
    for(int i=ans.sz-1;i>=0;i--){
        while(k>=(1<<i)){
            v[i].pb(p++);
            k-=(1<<i);
        }
    }
    vector<int> val;
    for(int i=0;i<ans.sz;i++){
        for(int j:v[i])val.pb(j);
        val.pb(ans[i]);
    }

    int* a=new int[val.sz];
    for(int i=0;i<val.sz;i++)a[i]=val[i];
    return a;
}

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

perm.cpp:5:21: error: expected ')' before ';' token
    5 | #define ll long long;
      |                     ^
perm.cpp:7:28: note: in expansion of macro 'll'
    7 | int* construct_permutation(ll k){
      |                            ^~
perm.cpp:7:27: note: to match this '('
    7 | int* construct_permutation(ll k){
      |                           ^
perm.cpp:7:6: error: ambiguating new declaration of 'int* construct_permutation(long long int)'
    7 | int* construct_permutation(ll k){
      |      ^~~~~~~~~~~~~~~~~~~~~
In file included from perm.cpp:1:
perm.h:3:18: note: old declaration 'std::vector<int> construct_permutation(long long int)'
    3 | std::vector<int> construct_permutation(long long k);
      |                  ^~~~~~~~~~~~~~~~~~~~~
perm.cpp:7:31: error: 'k' does not name a type
    7 | int* construct_permutation(ll k){
      |                               ^