Submission #767159

#TimeUsernameProblemLanguageResultExecution timeMemory
767159Ahmed57Permutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int> construct_permutation(long long k){ k--; vector<int> 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); } } return v; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:20:13: error: 'n' was not declared in this scope
   20 |             n-=(1LL<<i);
      |             ^