Submission #1366797

#TimeUsernameProblemLanguageResultExecution timeMemory
1366797ezzzayPermutation (APIO22_perm)C++20
Compilation error
0 ms0 KiB
#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
vi fun(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 = fun(k / i);
            vi r = fun(i);
            for(auto& x: r) x += l.size();
            l.insert(l.end(), all(r));
            return l;
        }
    }
    vi a = fun(k / 2);
    a.pb(a.size());
    if(k & 1) a.insert(a.begin(), a.size());
    return a;
}
vi construct_permutation(ll k){
    return fun(k);
}

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> fun(long long int)':
perm.cpp:17:31: error: 'all' was not declared in this scope
   17 |             l.insert(l.end(), all(r));
      |                               ^~~
perm.cpp:17:31: note: suggested alternatives:
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:2:
/usr/include/c++/13/bits/fs_fwd.h:154:7: note:   'std::filesystem::perms::all'
  154 |       all               =  0777,
      |       ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:89:
/usr/include/c++/13/ranges:1308:27: note:   'std::ranges::views::all'
 1308 |     inline constexpr _All all;
      |                           ^~~