Submission #619564

# Submission time Handle Problem Language Result Execution time Memory
619564 2022-08-02T12:58:07 Z Lobo Permutation (APIO22_perm) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "perm.h"
using namespace std;
#define 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

perm.cpp:5:26: error: 'std::vector<int> construct_permutation' redeclared as different kind of entity
    5 | vi construct_permutation(ll k) {
      |                          ^~
In file included from perm.cpp:2:
perm.h:3:18: note: previous declaration 'std::vector<int> construct_permutation(long long int)'
    3 | std::vector<int> construct_permutation(long long k);
      |                  ^~~~~~~~~~~~~~~~~~~~~
perm.cpp:5:26: error: 'll' was not declared in this scope
    5 | vi construct_permutation(ll k) {
      |                          ^~