Submission #793491

#TimeUsernameProblemLanguageResultExecution timeMemory
793491mathematikDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> #define ll long long using namespace std; int binary_index[25][400001][25];//index, +, max excluded ll binary_add[25][400001][25]; int binary_max[25][400001][25]; ll min(int a, ll b) { return a < b ? a : b; } void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { s.push_back(0); p.push_back(0); w.push_back(n); l.push_back(n); n++; for (int range = 0; range < 25; range++) { ll r = 1 << range; for (int i = 0; i < n; i++) { if (s[i] <= r) { binary_index[range][i][0] = w[i]; binary_add[range][i][0] = s[i]; binary_max[range][i][0] = LLONG_MAX; } else { binary_index[range][i][0] = l[i]; binary_add[range][i][0] = p[i]; binary_max[range][i][0] = s[i]; } } for (int i = 1; i < 25; i++) { for (int ind = 0; ind < n; ind++) { int pointer = binary_index[range][ind][i - 1]; binary_index[range][ind][i] = binary_index[range][pointer][i - 1]; binary_add[range][ind][i] = binary_add[range][ind][i - 1] + binary_add[range][pointer][i - 1]; binary_max[range][ind][i] = min(binary_max[range][ind][i - 1], binary_max[range][pointer][i - 1] - binary_add[range][ind][i - 1]); } } } } long long simulate(int x, int z) { ll t = z; for (int r = 0; r < 24; r++) { for (int s = 24; s >= 0; s--) { if (binary_max[r][x][s] > t) { t += binary_add[r][x][s]; x = binary_index[r][x][s]; } } } t += binary_add[24][x][24]; return t; }

Compilation message (stderr)

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:31:31: warning: overflow in conversion from 'long long int' to 'int' changes value from '9223372036854775807' to '-1' [-Woverflow]
   31 |     binary_max[range][i][0] = LLONG_MAX;
      |                               ^~~~~~~~~
/tmp/ccpkrmmU.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