Submission #442505

#TimeUsernameProblemLanguageResultExecution timeMemory
442505JovanBDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXN = 400000; const int LOG2 = 24; const int LOG4 = 11; const int INF = 1000000000; int dp[LOG2+1][MAXN+5][LOG4+1]; ll dod[LOG2+5][MAXN+5][LOG4+1]; int gde[LOG2+5][MAXN+5][LOG4+1]; int s[MAXN+5]; int pl[MAXN+5]; int win[MAXN+5]; int lose[MAXN+5]; int N; void init(int n, std::vector<int> S, std::vector<int> P, std::vector<int> W, std::vector<int> L){ N = n; for(int i=0; i<n; i++){ s[i] = S[i]; pl[i] = P[i]; win[i] = W[i]; lose[i] = L[i]; } s[n] = 0; pl[n] = 0; win[n] = n; lose[n] = n; for(int k=0; k<=LOG2; k++){ for(int i=0; i<=n; i++){ if((1<<k) >= s[i]){ dp[k][i][0] = INF; dod[k][i][0] = s[i]; gde[k][i][0] = win[i]; } else{ dp[k][i][0] = s[i] - 1; dod[k][i][0] = pl[i]; gde[k][i][0] = lose[i]; } } for(int j=1; j<=LOG4; j++){ for(int i=0; i<=n; i++){ int h = gde[k][i][j-1]; int mndp = dp[k][i][j-1]; ll udod = dod[k][i][j-1]; h = gde[k][h][j-1]; mndp = min(1LL*mndp, dp[k][h][j-1] == INF ? INF : dp[k][h][j-1] - min(1LL*INF, udod)); udod += dod[k][h][j-1]; h = gde[k][h][j-1]; mndp = min(1LL*mndp, dp[k][h][j-1] == INF ? INF : dp[k][h][j-1] - min(1LL*INF, udod)); udod += dod[k][h][j-1]; h = gde[k][h][j-1]; mndp = min(1LL*mndp, dp[k][h][j-1] == INF ? INF : dp[k][h][j-1] - min(1LL*INF, udod)); udod += dod[k][h][j-1]; gde[k][i][j] = h; dod[k][i][j] = udod; dp[k][i][j] = max(mndp, -5); } } } return; } ll simuliraj(int x, ll z){ if(x == N) return z; int k = 0; for(int j=0; j<=LOG2; j++){ if((1<<j) <= z) k = j; } for(int j=LOG4; j>=0; j--){ for(int times=0; times<3; times++){ if(dp[k][x][j] >= z){ z += dod[k][x][j]; x = gde[k][x][j]; } } } if(x == N) return z; if(z >= s[x]) return simuliraj(win[x], z + s[x]); return simuliraj(lose[x], z + pl[x]); } long long simulate(int x, int z) { return simuliraj(x, z); }

Compilation message (stderr)

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