답안 #979043

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
979043 2024-05-10T07:03:32 Z rshohruh 순열 (APIO22_perm) C++17
컴파일 오류
0 ms 0 KB
#include "perm.h"#include "bits/stdc++.h"using namespace std;int count_zeros(long long k){    return k ? ((k&1)^1) + count_zeros(k>>1) : 0;}vector<int> construct_permutation(long long k){    --k;    vector<int> a;    while(count_zeros(k - ((1LL<<a.size())-1)) > a.size())        a.push_back(a.size());    k -= (1LL<<a.size()) - 1;    for(int i = 0; k > 0; ++ i){        if((k>>i)&1){            a.insert(a.begin()+i, a.size());            k -= 1ll<<i;        }    }    return a;}

Compilation message

perm.cpp:1:18: warning: extra tokens at end of #include directive
    1 | #include "perm.h"#include "bits/stdc++.h"using namespace std;int count_zeros(long long k){    return k ? ((k&1)^1) + count_zeros(k>>1) : 0;}vector<int> construct_permutation(long long k){    --k;    vector<int> a;    while(count_zeros(k - ((1LL<<a.size())-1)) > a.size())        a.push_back(a.size());    k -= (1LL<<a.size()) - 1;    for(int i = 0; k > 0; ++ i){        if((k>>i)&1){            a.insert(a.begin()+i, a.size());            k -= 1ll<<i;        }    }    return a;}
      |                  ^
/usr/bin/ld: /tmp/cc9CWsMb.o: in function `main':
grader.cpp:(.text.startup+0x240): undefined reference to `construct_permutation(long long)'
collect2: error: ld returned 1 exit status