Submission #606920

#TimeUsernameProblemLanguageResultExecution timeMemory
606920jiahngDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef pair<int32_t, ll> pi; typedef vector <int> vi; typedef vector <pi> vpi; typedef pair<pi, ll> pii; typedef set <ll> si; typedef long double ld; #define f first #define s second #define mp make_pair #define FOR(i,s,e) for(int i=s;i<=int(e);++i) #define DEC(i,s,e) for(int i=s;i>=int(e);--i) #define pb push_back #define all(x) (x).begin(), (x).end() #define lbd(x, y) lower_bound(all(x), y) #define ubd(x, y) upper_bound(all(x), y) #define aFOR(i,x) for (auto i: x) #define mem(x,i) memset(x,i,sizeof x) #define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) #define maxn 400010 #define maxb 20 #define INF (ll)1e18 #define MOD 1000000007 typedef pair <vi, int> pvi; typedef pair <int,pi> ipi; typedef vector <pii> vpii; pi dp[maxn][maxb][maxb]; // (ending node, added val) if start at i and do 2^k steps winning if 2^j >= S int mx[maxn][maxb][maxb]; // max z for dp[i][j][k] to be accurate int S[maxn], P[maxn], W[maxn], L[maxn]; int N; int msb(int x){ return 63 - __builtin_clzl(x); } void init(int32_t n, std::vector<int32_t> s, std::vector<int32_t> p, std::vector<int32_t> w, std::vector<int32_t> l) { N = n; FOR(i,0,N-1){ S[i] = s[i], P[i] = p[i], W[i] = w[i], L[i] = l[i]; } FOR(i,0,N-1) FOR(j,0,maxb-1){ if ((1 << j) >= S[i]) dp[i][j][0] = pi(W[i], S[i]); else dp[i][j][0] = pi(L[i], P[i]); if (S[i] > (1 << j)) mx[i][j][0] = S[i] - 1; else mx[i][j][0] = INF; } FOR(j,0,maxb-1) dp[N][j][0] = pi(N, 0); FOR(k,0,maxb-1) FOR(j,0,maxb-1){ FOR(i,0,N){ dp[i][j][k] = dp[dp[i][j][k-1].f][j][k-1]; dp[i][j][k].s += dp[i][j][k-1].s; mx[i][j][k] = min(mx[i][j][k-1], mx[dp[i][j][k-1].f][j][k-1] - dp[i][j][k-1].s); } } return; } long long simulate(int32_t x, int32_t _z) { ll z = _z; while (1){ //cout << msb(z) << ' '; DEC(k,maxb-1,0) if (z <= mx[x][msb(z)][k] && dp[x][msb(z)][k].f < N){ z += dp[x][msb(z)][k].s; x = dp[x][msb(z)][k].f; } //cout << x << ' ' << z << '\n'; if (z >= S[x] && W[x] == N) return z + S[x]; if (z < S[x] && L[x] == N) return z + P[x]; if (z >= S[x]){ z += S[x]; x = W[x]; }else{ z += P[x]; x = L[x]; } } return 0; }

Compilation message (stderr)

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