Submission #1118735

#TimeUsernameProblemLanguageResultExecution timeMemory
1118735Username_taken12Permutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> construct_permuation(long long k) { int cnt = std::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; } /*int main() { long long k; cin>>k; vector<int> ans = construct_permuation(k); for(int i=0; i<ans.size(); i++) cout<<ans[i]<<" "; cout<<endl; }*/

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permuation(long long int)':
perm.cpp:6:17: error: 'popcount' is not a member of 'std'; did you mean 'count'?
    6 |  int cnt = std::popcount((unsigned long long) k);
      |                 ^~~~~~~~
      |                 count