Submission #1300570

#TimeUsernameProblemLanguageResultExecution timeMemory
1300570retardeHack (APIO25_hack)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "hack.h"
#define int long long
using namespace std;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

typedef long double ld;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef map<int, int> mii;
typedef unordered_map<int, int> umii;

const int mod = 1e9 + 7;
const int inf = INTMAX_MAX;

/*
10
67
31912
5131
53187
674319
13
17
3
351728
431
*/

vi fact[1000000001];
int can[1000000001];

void pre() {
    for (int f = 2; f <= 1e9; f++) {
        for (int mul = 2*f; mul <= 1e9; mul += f) {
            fact[mul].pb(f);
        }
    }
    for (int i = 1; i <= 1e9; i++) fact[i].pb(i);
}

bool done = false;

signed hack() {
    if (!done) {
        pre();
        done = true;
    }
    memset(can, 0, sizeof(can));

    int lim = 1e9 + 1;
    for (int it = lim; it >= 2; it--) {
        if (can[it - 1] == -1) continue;
        vi x = {1, it};
        int y = collisions(x);

        if (y > 0) {
            // cout << 1 << " " << it << " matched\n";
            int ptr = it - 1;
            vi facts = fact[ptr];
            sort(all(facts));

            for (auto &fac : facts) {
                int f = fac;
                if (f == 1) continue;
                if (can[f] == -1) continue;
                else {
                    // maybe change
                    vi y = {1, f + 1};
                    if (collisions(y) > 0) {
                        return f;
                    }
                }
            }
        } else {
            int ptr = it - 1;
            for (auto &f : fact[ptr]) {
                can[f] = -1;
                can[ptr / f] = -1;
            }
        }
    }
    assert(false);
    return 10;
}

Compilation message (stderr)

/tmp/ccr0O9DU.o: in function `__tcf_0':
hack.cpp:(.text+0x12): relocation truncated to fit: R_X86_64_PC32 against symbol `fact' defined in .bss section in /tmp/ccr0O9DU.o
/tmp/ccr0O9DU.o: in function `pre()':
hack.cpp:(.text+0x4b6): relocation truncated to fit: R_X86_64_PC32 against symbol `fact' defined in .bss section in /tmp/ccr0O9DU.o
hack.cpp:(.text+0x5c6): relocation truncated to fit: R_X86_64_PC32 against symbol `fact' defined in .bss section in /tmp/ccr0O9DU.o
/tmp/ccr0O9DU.o: in function `hack()':
hack.cpp:(.text+0x868): relocation truncated to fit: R_X86_64_PC32 against symbol `fact' defined in .bss section in /tmp/ccr0O9DU.o
/tmp/ccNLEJvs.o: in function `collisions(std::vector<long long, std::allocator<long long> >)':
grader.cpp:(.text+0x59b): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x5b1): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text+0x6ee): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/tmp/ccNLEJvs.o: in function `main':
grader.cpp:(.text.startup+0x1f9): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1ff): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x20e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x21a): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1f): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1ed): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x252): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2bc): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x316): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x50f): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x57d): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5f0): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x654): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status