Submission #794516

#TimeUsernameProblemLanguageResultExecution timeMemory
794516finn__던전 (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "dungeons.h" using namespace std; constexpr size_t N = 400001, K = 26; size_t n; uint32_t f[K + 1][K][N], m[K + 1][K][N]; uint64_t u[K + 1][K][N]; vector<int> s, p, w, l; void init(int n_, vector<int> s_, vector<int> p_, vector<int> w_, vector<int> l_) { n = n_; s = move(s_); p = move(p_); w = move(w_); l = move(l_); for (size_t k = 0; k < K; ++k) { for (size_t i = 0; i < n; ++i) { if (s[i] < 1 << k) f[k][0][i] = w[i], u[k][0][i] = s[i], m[k][0][i] = UINT32_MAX; else f[k][0][i] = l[i], u[k][0][i] = p[i], m[k][0][i] = s[i]; } f[k][0][n] = n; u[k][0][n] = 0; m[k][0][n] = UINT32_MAX; for (size_t j = 1; j < K; ++j) for (size_t i = 0; i < n; ++i) { size_t const intermediate = f[k][j - 1][i]; f[k][j][i] = f[k][j - 1][intermediate]; u[k][j][i] = u[k][j - 1][i] + u[k][j - 1][intermediate]; if (intermediate == n) m[k][j][i] = UINT32_MAX; m[k][j][i] = m[k][j - 1][i]; if (m[k][j - 1][intermediate] != UINT32_MAX) m[k][j][i] = min<uint64_t>(m[k][j][i], min<uint64_t>(m[k][j - 1][i], m[k][j - 1][intermediate] - min<uint64_t>(m[k][j - 1][intermediate], u[k][j - 1][i]))); } } } long long simulate(int x, int z) { long long strength = z; while (x != n) { size_t const k = min<size_t>(K - 1, __lg(strength)); for (size_t j = K - 1; j < K; --j) if (m[k][j][x] > strength) { strength += u[k][j][x]; x = f[k][j][x]; break; } if (x != n) { if (strength >= s[x]) { strength += s[x]; x = w[x]; } else { strength += p[x]; x = l[x]; } } } return strength; }

Compilation message (stderr)

dungeons.cpp: In function 'long long int simulate(int, int)':
dungeons.cpp:58:14: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   58 |     while (x != n)
      |            ~~^~~~
dungeons.cpp:69:15: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   69 |         if (x != n)
      |             ~~^~~~
/tmp/ccUW8BVL.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