제출 #992177

#제출 시각아이디문제언어결과실행 시간메모리
992177pavement던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define pb push_back const int MAX_N = 400000, BAND_LIM = 23, DECOMP_LIM = 24; int n, to[BAND_LIM][DECOMP_LIM][MAX_N + 1]; ll wei[BAND_LIM][DECOMP_LIM][MAX_N + 1], lim[BAND_LIM][DECOMP_LIM][MAX_N + 1]; vector<int> s, p, w, l; vector<ll> winner; void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { ::n = n; ::s = s; ::p = p; ::w = w; ::l = l; s.pb(0); p.pb(0); w.pb(n); l.pb(n); winner.resize(n + 1); for (int i = n - 1; i >= 0; i--) { winner[i] = winner[w[i]] + s[i]; } for (int b = 0; b < BAND_LIM; b++) { int lb = (1 << b), rb = (1 << (b + 1)) - 1; for (int i = 0; i <= n; i++) { if (s[i] < lb) { // instant-win to[b][0][i] = w[i]; wei[b][0][i] = s[i]; lim[b][0][i] = LLONG_MAX; } else if (s[i] > rb) { // instant-lose to[b][0][i] = l[i]; wei[b][0][i] = p[i]; lim[b][0][i] = LLONG_MAX; } else { to[b][0][i] = l[i]; wei[b][0][i] = p[i]; lim[b][0][i] = s[i]; } } for (int k = 1; k < DECOMP_LIM; k++) { for (int i = 0; i <= n; i++) { to[b][k][i] = to[b][k - 1][to[b][k - 1][i]]; if (wei[b][k - 1][i] > LLONG_MAX - wei[b][k - 1][to[b][k - 1][i]]) { wei[b][k][i] = LLONG_MAX; } else { wei[b][k][i] = wei[b][k - 1][i] + wei[b][k - 1][to[b][k - 1][i]]; } if (lim[b][k - 1][to[b][k - 1][i]] - wei[b][k - 1][i] < 0) { lim[b][k][i] = 0; } else { lim[b][k][i] = min(lim[b][k - 1][i], lim[b][k - 1][to[b][k - 1][i]] - wei[b][k - 1][i]); } } } } } ll simulate(int x, int _z) { ll z = _z; for (int b = 0; b < BAND_LIM; b++) { int rb = (1 << (b + 1)) - 1; if (z > rb) { // past this band continue; } for (int k = DECOMP_LIM - 1; k >= 0; k--) { if (lim[b][k][x] <= z || wei[b][k][x] > LLONG_MAX - z || z + wei[b][k][x] > rb) { continue; } z += wei[b][k][x]; x = to[b][k][x]; } if (x == n) { return z; } for (int iter = 0; iter < 2; iter++) { if (z >= s[x]) { z += s[x]; x = w[x]; } else { z += p[x]; x = l[x]; } if (x == n) { return z; } } assert(z > rb); } // win all the way return z + winner[x]; }

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

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