Submission #1261307

#TimeUsernameProblemLanguageResultExecution timeMemory
1261307biankDungeons Game (IOI21_dungeons)C++20
Compilation error
0 ms0 KiB
#include "dungeons.h"
#include <bits/stdc++.h>
 
#define forsn(i, s, n) for (int i = int(s); i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
#define dforsn(i, s, n) for (int i = int(n) - 1; i >= int(s); i--)
#define dforn(i, n) dforsn(i, 0, n)
 
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
 
#define pb push_back
#define eb emplace_back
 
#define fst first
#define snd second
 
using namespace std;
 
using vi = vector<int>;
using ii = pair<int, int>;
using ll = long long;

const int MAX_N = 4e5 + 9;
const int MAX_K = 24;
const ll INF = 1e18;

ll prize[MAX_K][MAX_K][MAX_N];
ll minPower[MAX_K][MAX_K][MAX_N];
int nxt[MAX_K][MAX_K][MAX_N];

vi s, p, w, l;
int n;

void init(int _n, vi _s, vi _p, vi _w, vi _l) {
    n = _n, s = _s, p = _p, w = _w, l = _l;
    s.pb(0), w.pb(n), p.pb(0), l.pb(n);
    n++;
    forn(k, MAX_K) {
        forn(i, n) {
            if (s[i] < 1 << k) {
                nxt[k][0][i] = w[i];
                prize[k][0][i] = s[i];
                minPower[k][0][i] = INF;
            } else {
                nxt[k][0][i] = l[i];
                prize[k][0][i] = p[i];
                minPower[k][0][i] = s[i];
            }
        }
        forn(b, MAX_K - 1) forn(i, n) {
            int j = nxt[k][b][i];
            nxt[k][b + 1][i] = nxt[k][b][j];
            prize[k][b + 1][i] = prize[k][b][i] + prize[k][b][j];
            minPower[k][b + 1][i] = min(minPower[k][b][i], minPower[k][b][j] - prize[k][b][i]);
        }
    }
}

ll simulate(int x, int z) {
    ll curr = z;
    forn(k, MAX_K) {
        dforn(i, MAX_K) {
            if (curr >= (1 << k) - 1 && minPower[k][i][x] > curr) {
                curr += prize[k][i][x];
                x = nxt[k][i][x];
            }
        }
        if (s[x] <= curr) {
            curr += s[x], x = w[x];
        } else {
            curr += p[x], x = l[x];
        }
    }
    return curr;
}

Compilation message (stderr)

/tmp/ccDCeyx2.o: in function `main':
grader.cpp:(.text.startup+0x15e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x165): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x183): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x18a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x196): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x19d): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1ac): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1b3): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1bf): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1c6): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1d2): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1c): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1c6): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x260): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2e2): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x353): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x541): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5e5): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x670): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x6e9): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
/usr/bin/ld: final link failed
collect2: error: ld returned 1 exit status