Submission #660605

#TimeUsernameProblemLanguageResultExecution timeMemory
660605BovmeloPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k) {
   vector<int> a;
   int c = 0, t = 0;
   for (int i = __lg(k) - 1; ~i; i--) {
      a.push_back(t++);
      if (k >> i & 1) {
         if (i > 0 && (k >> (i - 1) & 1) && c > 1)
            a.push_back(t++), a.insert(l.begin() + 2, t++), i--;
         else
            a.insert(l.begin(), t++), c++;
      }
   }
   return a;
}

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:11:40: error: 'l' was not declared in this scope
   11 |             a.push_back(t++), a.insert(l.begin() + 2, t++), i--;
      |                                        ^
perm.cpp:13:22: error: 'l' was not declared in this scope
   13 |             a.insert(l.begin(), t++), c++;
      |                      ^