Submission #981445

# Submission time Handle Problem Language Result Execution time Memory
981445 2024-05-13T08:24:19 Z 12345678 Dungeons Game (IOI21_dungeons) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=4e5+5, lx=9, kx=25;

ll N, pw[20];
vector<ll> S(nx), P(nx), W(nx), L(nx);

struct edge
{
    ll out, cost, t;
    edge(ll out=0, ll cost=0, ll t=0): out(out), cost(cost), t(t){}
} dp[lx][nx][kx];

void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
    N=n;
    pw[0]=1;
    for (int i=1; i<20; i++) pw[i]=pw[i-1]*8;
    for (int i=0; i<n; i++) S[i]=s[i], P[i]=p[i], W[i]=w[i], L[i]=l[i];
    W[n]=L[n]=n;
    for (int i=0; i<lx; i++)
    {
        for (int u=0; u<=n; u++)
        {
            if (s[u]<=pw[i]) dp[i][u][0]=edge(W[u], S[u], 1e18);
            else dp[i][u][0]=edge(L[u], P[u], S[u]);
        }
        for (int j=1; j<kx; j++)
        {
            for (int u=0; u<=n; u++)
            {
                int v=dp[i][u][j-1].out;
                ll out=dp[i][v][j-1].out;
                ll cost=dp[i][u][j-1].cost+dp[i][v][j-1].cost;
                ll t=min(dp[i][u][j-1].t, dp[i][v][j-1].t-dp[i][u][j-1].cost);
                dp[i][u][j]=edge(out, cost, t);
            }
        }
    }
}

long long simulate(int x, int z) {
    ll cur=z, st=0;
    while (x!=N)
    {
        //cout<<"debug "<<x<<' '<<cur<<' '<<st<<'\n';
        while (st+1<lx&&pw[st+1]<=cur) st++;
        for (int i=kx-1; i>=0; i--) if (dp[st][x][i].t>cur) cur+=dp[st][x][i].cost, x=dp[st][x][i].out; //cout<<"here "<<i<<' '<<cur<<' '<<x<<'\n';
        //cout<<"after "<<x<<' '<<cur<<' '<<st<<'\n';
        if (cur>=S[x]) cur+=S[x], x=W[x];
        else cur+=P[x], x=L[x];
    }
	return cur;
}

Compilation message

/tmp/ccWISI5f.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