Submission #439884

#TimeUsernameProblemLanguageResultExecution timeMemory
439884phathnv던전 (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 4e5 + 7;
const int L = 17;

int n;
vector<int> s, p, w, l;
int nxt[L][L][N];
long long f[L][L][N], sum[L][L][N];

void init(int _n, vector<int> _s, vector<int> _p, vector<int> _w, vector<int> _l) {
    n = _n;
    s = _s;
    p = _p;
    w = _w;
    l = _l;
    for (int b = 0; b < L; b++) {
        for (int i = 0; i < n; i++) {
            nxt[b][0][i] = (s[i] <= (256 << b)? w[i] : l[i]);
            sum[b][0][i] = (s[i] <= (256 << b)? s[i] : p[i]);
            f[b][0][i] = (s[i] < (256 << b)? 1e18 : s[i]);
        }
        nxt[b][0][n] = -1;
        for (int i = 1; i < L; i++)
            for (int j = 0; j <= n; j++) {
                nxt[b][i][j] = (nxt[b][i - 1][j] == -1? -1 : nxt[b][i - 1][nxt[b][i - 1][j]]);
                if (nxt[b][i][j] != -1) {
                    sum[b][i][j] = sum[b][i - 1][j] + sum[b][i - 1][nxt[b][i - 1][j]];
                    f[b][i][j] = min(f[b][i - 1][j], f[b][i - 1][nxt[b][i - 1][j]] - sum[b][i - 1][j]);
                }
            }
    }
	return;
}

long long simulate(int x, int _z) {
    long long z = _z;
    while (z < 256) {
        if (x == n)
            return z;
        if (z >= s[x]) {
            z += s[x];
            x = w[x];
        } else {
            z += p[x];
            x = l[x];
        }
    }
    for (int b = 0; b < L; b++) {
        if (z >= (256 << (b + 1)))
            continue;
        for (int i = L - 1; i >= 0; i--) {
            if (nxt[b][i][x] == -1)
                continue;
            if (z < f[b][i][x]) {
                z += sum[b][i][x];
                x = nxt[b][i][x];
            }
        }
        if (x == n)
            return z;
        assert(z >= s[x]);
        z += s[x];
        x = w[x];
    }
    for (int i = L - 1; i >= 0; i--)
        if (nxt[L - 1][i][x] != -1) {
            z += sum[L - 1][i][x];
            x = nxt[L - 1][i][x];
        }
    assert(x == n);
	return z;
}

Compilation message (stderr)

/tmp/ccO7Yl1m.o: in function `main':
grader.cpp:(.text.startup+0x178): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x17f): 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+0x1a4): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1b0): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1b7): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1c3): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1ca): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1d6): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1dd): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1e9): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status