제출 #1118734

#제출 시각아이디문제언어결과실행 시간메모리
1118734Username_taken12순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> construct_permuation(long long k) { int cnt = popcount((unsigned long long) k); int size =0; long long t=k; while(t>0){ size++; t/=2; } int len = size+cnt-1; int h=len; int a =1; vector<int> out; while(k>1){ if(k%2==1) out.push_back(h--); out.push_back(a++); k/=2; } return out; }

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

perm.cpp: In function 'std::vector<int> construct_permuation(long long int)':
perm.cpp:5:12: error: 'popcount' was not declared in this scope
    5 |  int cnt = popcount((unsigned long long) k);
      |            ^~~~~~~~