Submission #726738

#TimeUsernameProblemLanguageResultExecution timeMemory
726738vjudge1Permutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

vector<int> construct_permutation(int64_t k) {
        if (k == 1) return {};
        if (k == 2) return {0};
        for (int prime : {2, 3, 5, 7, 11}) {
                if (k % prime == 0 && k > prime) {
                        vector<int> le = construct_permutation(k / prime);
                        vector<int> re = construct_permutation(prime);
                        for (auto& a : re) a += le.size();
                        le.insert(le.end(), re.begin(), re.end());
                        return le;
                }
        }
        auto v = construct_permutation(k >> 1);
        v.emplace_back(v.size());
        for (auto& a : v) a++;
        v.emplace_back(0);
        return v;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccX7zxdG.o: in function `main':
grader.cpp:(.text.startup+0x240): undefined reference to `construct_permutation(long long)'
collect2: error: ld returned 1 exit status