Submission #1293582

#TimeUsernameProblemLanguageResultExecution timeMemory
1293582AksLolCodingPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; vi construct_permutation(ll k) { if(k == 1) return {}; if(k == 2) return vi{0}; for(int i: {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}) { if(k % i == 0 && k > i) { vi l = construct_permutation(k / i); vi r = construct_permutation(i); for(auto& x: r) x += l.size(); l.insert(l.end(), all(r)); return l; } } vi a = construct_permutation(k / 2); a.pb(a.size()); if(k & 1) a.insert(a.begin(), a.size()); return a; }

Compilation message (stderr)

perm.cpp: In function 'vi construct_permutation(ll)':
perm.cpp:14:31: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   14 |             l.insert(l.end(), all(r));
      |                               ^~~
      |                               std::filesystem::perms::all
In file included from /usr/include/c++/13/filesystem:48,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:200,
                 from perm.cpp:1:
/usr/include/c++/13/bits/fs_fwd.h:154:7: note: 'std::filesystem::perms::all' declared here
  154 |       all               =  0777,
      |       ^~~
perm.cpp:19:7: error: 'using vi = class std::vector<int>' {aka 'class std::vector<int>'} has no member named 'pb'
   19 |     a.pb(a.size());
      |       ^~