제출 #1330862

#제출 시각아이디문제언어결과실행 시간메모리
1330862farukDungeons Game (IOI21_dungeons)C++20
컴파일 에러
0 ms0 KiB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define pii pair<ll,ll>
#define ff first
#define ss second

const ll inf = 2e18;
const ll bv = 25;
const ll mb = 9;
const ll MAXN = 400001;

struct node{
    signed nxt;
    ll mini = inf;
    ll sum = 0;
};

static node lift[bv][mb][MAXN];

vector<ll> stg, win, lose, pen;

void init(signed _n, vector<signed> _s, vector<signed> _p,
          vector<signed> _w, vector<signed> _l) {

    ll n = _n;

    vector<ll> s(n), p(n), w(n), l(n);
    for (ll i = 0; i < n; i++)
        s[i] = _s[i], p[i] = _p[i], w[i] = _w[i], l[i] = _l[i];

    stg = s;
    win = w;
    lose = l;
    pen = p;

    vector<ll> par(n + 1, n);
    for (ll i = 0; i < n; i++)
        par[i] = l[i];

    vector<ll> c(n + 1, 0);
    for (ll i = 0; i < n; i++)
        c[i] = p[i];

    for (ll b = 0; b < bv; b++) {

        for (ll i = 0; i < n; i++) {
            lift[b][0][i].nxt = par[i];
            lift[b][0][i].sum = c[i];

            if (__lg(s[i]) == b)
                lift[b][0][i].mini = s[i];
            else
                lift[b][0][i].mini = inf;
        }

        for (ll bit = 0; bit < mb; bit++)
            lift[b][bit][n].nxt = n;

        for (ll bit = 1; bit < mb; bit++)
            for (ll i = 0; i < n; i++) {

                node &res = lift[b][bit][i];
                res = lift[b][bit - 1][i];

                for (ll it = 0;
                     it < (1LL << ((bv + mb - 1) / mb)) - 1;
                     it++) {

                    node y = lift[b][bit - 1][res.nxt];
                    res.nxt = lift[b][bit - 1][res.nxt].nxt;

                    if (y.mini != inf) {
                        ll gurt = y.mini - res.sum;
                        res.mini = min(res.mini,
                                       max(-1LL, gurt));
                    }

                    res.sum += y.sum;
                }
            }

        for (ll i = 0; i < n; i++)
            if (__lg(s[i]) <= b)
                par[i] = w[i], c[i] = s[i];
    }
}

void nxt(ll &x, ll &z)
{
    if (z >= stg[x])
        z += stg[x], x = win[x];
    else
        z += pen[x], x = lose[x];
}

long long simulate(signed _x, signed _z) {

    ll x = _x;
    ll z = _z;
    ll n = MAXN - 1;  // terminal index assumed at n

    for (ll b = 0; b < bv && x != n; b++) {
        for (ll bit = mb - 1; bit >= 0; bit--) {

            node cur = lift[b][bit][x];

            while ((b == bv - 1 || cur.sum + z < (1LL << (b + 1))) &&
                   cur.nxt != n &&
                   (cur.mini > z)) {

                x = cur.nxt;
                z += cur.sum;
                cur = lift[b][bit][x];
            }
        }
        nxt(x, z);
    }

    return z;
}

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccY1ut7r.o: in function `main':
grader.cpp:(.text.startup+0x14a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x151): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x16f): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x176): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x185): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x18c): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x198): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x19f): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1ab): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1b2): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1be): 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