Submission #1072196

#TimeUsernameProblemLanguageResultExecution timeMemory
1072196Ahmed57Dungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; //#define int long long array<long long,3> P[400001][13][24]; long long inf = 1e18 , N; vector<long long> S , PP , W , L; vector<long long> v; void init(int n, vector<int> s, vector<int> p, vector<int> w,vector<int> l){ for(auto i:s)S.push_back(i); for(auto i:p)PP.push_back(i); for(auto i:w)W.push_back(i); for(auto i:l)L.push_back(i); int cnt = 0;N = n; bool ss = 0;int cst = 0; while(cst<=1e7){ if(cnt>26){ cout<<"hi"<<endl;return ; } cst*=4; if(ss){ cst = max(cst,1); } v.push_back(cst); ss = 1; for(int i = 0;i<n;i++){ if(s[i]<=cst){ P[i][cnt][0] = {w[i],s[i],inf}; }else{ P[i][cnt][0] = {l[i],p[i],s[i]}; } } P[n][cnt][0] = {n,0,-inf}; for(int j = 1;j<24;j++){ for(int i = 0;i<=n;i++){ P[i][cnt][j][0] = P[P[i][cnt][j-1][0]][cnt][j-1][0]; P[i][cnt][j][1] = P[i][cnt][j-1][1]+P[P[i][cnt][j-1][0]][cnt][j-1][1]; P[i][cnt][j][2] = min(P[i][cnt][j-1][2],P[P[i][cnt][j-1][0]][cnt][j-1][2]-P[i][cnt][j-1][1]); } } cnt++; } } long long simulate(int x, int z) { long long sum = z; int cnt = 0; while(x!=N){ //if(cnt<1000)cout<<sum<<endl; cnt++; long long nah = lower_bound(v.begin(),v.end(),sum+1)-v.begin(); nah--; if(nah>26){ return -1; } for(int i = 23;i>=0;i--){ if(P[x][nah][i][2]>sum){ sum+=P[x][nah][i][1]; x = P[x][nah][i][0]; } } if(x==N)break; //cout<<sum<<" "<<x<<" "<<nah<<endl; if(sum>=S[x]){ sum+=S[x]; x = W[x]; }else{ sum+=PP[x]; x = L[x]; } } //cout<<cnt<<endl; return sum; }

Compilation message (stderr)

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