Submission #439694

#TimeUsernameProblemLanguageResultExecution timeMemory
439694tutisDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; long long N; long long mn[400002][19]; long long W[400002][19]; long long S[400002][19]; const int mxt = 13; long long f(int x) { long long r = 1; long long w = 1; while (x--) { w *= 4; r *= w; } return r; } long long mn1[mxt][400001][19]; long long mx1[mxt][400001][19]; long long tp[mxt][400001][19]; long long del[mxt][400001][19]; void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { N = n; for (int i = 0; i < s.size(); i++) { S[i][0] = s[i]; mn[i][0] = s[i]; } for (int i = 0; i < w.size(); i++) W[i][0] = w[i]; mn[n][0] = -1e17; S[n][0] = 0; W[n][0] = n; for (int t = 1; t < 19; t++) { for (int i = 0; i <= n; i++) { mn[i][t] = max(mn[i][t - 1], mn[W[i][t - 1]][t - 1] - S[i][t - 1]); W[i][t] = W[W[i][t - 1]][t - 1]; S[i][t] = S[i][t - 1] + S[W[i][t - 1]][t - 1]; } } for (int x = 0; x < mxt; x++) { long long v = f(x); mn1[x][n][0] = -1e17; mx1[x][n][0] = 1e17; tp[x][n][0] = n; del[x][n][0] = 0; for (int i = 0; i < n; i++) { if (s[i] > v) { mn1[x][i][0] = -1e17; mx1[x][i][0] = s[i] - 1; tp[x][i][0] = l[i]; del[x][i][0] = p[i]; } else { mn1[x][i][0] = s[i]; mx1[x][i][0] = 1e17; tp[x][i][0] = w[i]; del[x][i][0] = s[i]; } } for (int t = 1; t < 19; t++) { for (int i = 0; i <= n; i++) { int i_ = tp[x][i][t - 1]; long long del_ = del[x][i][t - 1]; mn1[x][i][t] = max(mn1[x][i][t - 1], mn1[x][i_][t - 1] - del_); mx1[x][i][t] = min(mx1[x][i][t - 1], mx1[x][i_][t - 1] - del_); tp[x][i][t] = tp[x][i_][t - 1]; del[x][i][t] = del[x][i][t - 1] + del[x][i_][t - 1]; } } } } long long simulate(int x, int z) { long long s = z; while (x != N) { if (s >= mn[x][0]) { for (int t = 18; t >= 0; t--) { if (s >= mn[x][t]) { s += S[x][t]; x = W[x][t]; } if (s < mn[x][0]) break; } } for (int v = 0; v < mxt; v++) { if (s >= mn1[v][x][0] && s <= mx1[v][x][0]) for (int t = 18; t >= 0; t--) { if (s >= mn1[v][x][t] && s <= mx1[v][x][t]) { s += del[v][x][t]; x = tp[v][x][t]; } } } } return s; }

Compilation message (stderr)

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for (int i = 0; i < s.size(); i++)
      |                  ~~^~~~~~~~~~
dungeons.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for (int i = 0; i < w.size(); i++)
      |                  ~~^~~~~~~~~~
/tmp/ccxc30lL.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