Submission #929103

#TimeUsernameProblemLanguageResultExecution timeMemory
929103abcvuitunggioDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; const int base=4,sz=11; const long long INF=1e18; int N,nxt[400001][24][sz+1],lg[10000001]; long long mx[400001][24],mn[400001][24][sz],sum[400001][24][sz+1]; vector <int> S,P,ve={1}; void init(int n, vector <int> s, vector <int> p, vector <int> w, vector <int> l){ N=n,S=s,P=p; for (int i=1;i<sz;i++) ve.push_back(ve.back()*base); for (int i=2;i<10000001;i++) lg[i]=lg[i/2]+1; lg[0]=-1; memset(nxt,-1,sizeof(nxt)); for (int i=0;i<n;i++){ for (int j=0;j<sz;j++) if (s[i]<=ve[j]){ nxt[i][0][j]=w[i]; sum[i][0][j]=s[i]; mn[i][0][j]=INF; } else{ nxt[i][0][j]=l[i]; sum[i][0][j]=p[i]; mn[i][0][j]=s[i]; } nxt[i][0][sz]=w[i]; mx[i][0]=sum[i][0][sz]=s[i]; } for (int j=1;j<24;j++){ for (int i=0;i<n;i++) for (int k=0;k<=sz;k++){ if (nxt[i][j-1][k]==-1) continue; int u=nxt[i][j-1][k]; nxt[i][j][k]=nxt[u][j-1][k]; if (k<sz) mn[i][j][k]=min(mn[i][j-1][k],mn[u][j-1][k]-sum[i][j-1][k]); else mx[i][j]=max(mx[i][j-1],mx[u][j-1]-sum[i][j-1][k]); sum[i][j][k]=sum[i][j-1][k]+sum[u][j-1][k]; } } } long long simulate(int x, int Z){ int b=0,cur=0; long long z=Z; while (x<N){ while (cur<sz&&ve[cur]<=z) cur++; int j=(b?cur-1:sz); for (int i=(b?lg[max(10000000-z,0LL)]:23);i>=0;i--) if (nxt[x][i][j]!=-1) if ((b&&z<mn[x][i][j])||(!b&&z>=mx[x][i])){ z+=sum[x][i][j]; x=nxt[x][i][j]; } b^=1; } return z; }

Compilation message (stderr)

/tmp/ccgraqcF.o: in function `simulate(int, int)':
dungeons.cpp:(.text+0x158): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccgraqcF.o
/tmp/ccgraqcF.o: in function `init(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)':
dungeons.cpp:(.text+0x2ff): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccgraqcF.o
/tmp/ccgraqcF.o: in function `_GLOBAL__sub_I_N':
dungeons.cpp:(.text.startup+0x8): relocation truncated to fit: R_X86_64_PC32 against `.bss'
dungeons.cpp:(.text.startup+0x22): relocation truncated to fit: R_X86_64_PC32 against `.bss'
/tmp/ccFTcy1H.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): 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