제출 #972932

#제출 시각아이디문제언어결과실행 시간메모리
972932NemanjaSo2005던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.h" #include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=4e5+5; const int maxl=25; const int baza=8; int N,step[10],potrebno[maxn]; ll dobija[maxn]; int koji[maxn][baza+2][maxl+2]; ll suma[maxn][baza+2][maxl+2],gubit[maxn][baza+2][maxl+2]; vector<int> S,P,W,L; void init(int n,vector<int> s,vector<int> p,vector<int> w,vector<int> l){ S=s; P=p; W=w; L=l; N=n; potrebno[N]=1; dobija[N]=0; for(int i=N-1;i>=0;i--){ potrebno[i]=max(s[i],potrebno[w[i]]-s[i]); dobija[i]=dobija[w[i]]+s[i]; } step[0]=1; for(int i=1;i<=baza;i++) step[i]=step[i-1]*baza; for(int b=0;b<baza;b++){ for(int i=0;i<N;i++) if(s[i]<=step[b]){ koji[i][b][0]=w[i]; suma[i][b][0]=s[i]; gubit[i][b][0]=1e9; } else{ koji[i][b][0]=l[i]; suma[i][b][0]=p[i]; gubit[i][b][0]=s[i]; } for(int j=1;j<=maxl;j++) for(int i=1;i<=N;i++){ int sl=koji[i][b][j-1]; koji[i][b][j]=koji[sl][b][j-1]; suma[i][b][j]=suma[i][b][j-1]+suma[sl][b][j-1]; gubit[i][b][j]=min(gubit[i][b][j-1],gubit[sl][b][j-1]-suma[i][b][j-1]); } } } ll simulate(int poz,ll snaga){ if(potrebno[poz]<=snaga) return snaga+dobija[poz]; int b=baza-1; while(step[b]>snaga) b--; for(int i=maxl;i>=0;i--) if(gubit[poz][b][i]>snaga){ snaga+=suma[poz][b][i]; poz=koji[poz][b][i]; } for(int it=1;it<=5;it++){ if(poz==N) break; if(snaga>=S[poz]){ snaga+=S[poz]; poz=W[poz]; } else{ snaga+=P[poz]; poz=L[poz]; } } return simulate(poz,snaga); }

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

/tmp/ccJae5p8.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: grader.cpp:(.text.startup+0x440): undefined reference to `simulate(int, int)'
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status