Submission #1126542

#TimeUsernameProblemLanguageResultExecution timeMemory
1126542Zbyszek99Dungeons Game (IOI21_dungeons)C++20
Compilation error
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define ll long long #define ld long double #define ull unsigned long long #define ff first #define ss second #define pii pair<int,int> #define pll pair<long long, long long> #define vi vector<int> #define vl vector<long long> #define pb push_back #define rep(i, b) for(int i = 0; i < (b); ++i) #define rep2(i,a,b) for(int i = a; i <= (b); ++i) #define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c) #define count_bits(x) __builtin_popcountll((x)) #define all(x) (x).begin(),(x).end() #define siz(x) (int)(x).size() #define forall(it,x) for(auto& it:(x)) using namespace __gnu_pbds; using namespace std; typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; //mt19937 mt;void random_start(){mt.seed(chrono::time_point_cast<chrono::milliseconds>(chrono::high_resolution_clock::now()).time_since_epoch().count());} //ll rand(ll a, ll b) {return a + (mt() % (b-a+1));} const int INF = 1e9+50; const ll INF_L = 1e18+40; const ll MOD = 1e9+7; int P[16]; struct jump_str { int v; ll sum; ll ile; }; jump_str jump[16][400001][16]; int l[400001]; int w[400001]; ll win_cost[400001]; int n; jump_str merge_jumps(jump_str s1, jump_str s2) { jump_str ans; ans.v = s2.v; ans.sum = s1.sum + s2.sum; ans.ile = min(s1.ile,s2.ile - s1.sum); return ans; } pll find_next_lose(int v, ll s, int p) { for(int i = 15; i >= 0; i--) { //cout << v << " " << s << " " << jump[p][v][i].v << " " << jump[p][v][i].ile << " " << jump[p][v][i].sum << " " << i << " " << p << " jump\n"; if(jump[p][v][i].ile > s) { s += (ll)jump[p][v][i].sum; v = jump[p][v][i].v; } //cout << v << " " << s << " " << jump[p][v][i].v << " " << jump[p][v][i].ile << " " << jump[p][v][i].sum << " " << i << " jump\n"; if(jump[p][v][i].ile > s) { s += (ll)jump[p][v][i].sum; v = jump[p][v][i].v; } } //cout << v << " " << l[v] << " lost\n"; return {w[v],s + win_cost[v]}; } int find_seg(ll x) { rep(i,16) { if(x < P[i]) { return i-1; } } return 15; } void init(int N, vector<int> s, vector<int> p, vector<int> W, vector<int> L) { n = N; rep(i,n) { l[i] = L[i]; w[i] = W[i]; win_cost[i] = s[i]; } w[n] = n; l[n] = n; P[0] = 1; rep2(i,1,15) { P[i] = P[i-1] * 3; } rep(i,16) { rep(v,n) { if(s[v] <= P[i]) { jump[i][v][0] = {w[v],s[v],INF_L}; } else { jump[i][v][0] = {l[v],p[v],s[v]}; } } jump[i][n][0] = {n,0,INF_L}; rep2(j,1,15) { rep(v,n+1) { jump_str new_jump = merge_jumps(jump[i][v][j-1],jump[i][jump[i][v][j-1].v][j-1]); new_jump = merge_jumps(new_jump,jump[i][new_jump.v][j-1]); jump[i][v][j] = new_jump; } } } } ll simulate(int v, int Z) { ll z = Z; while(v != n) { int seg = find_seg(z); //cout << v << " " << z << " " << seg << " jumping\n"; pll nex = find_next_lose(v,z,seg); v = nex.ff; z = nex.ss; //cout << v << " " << z << " " << seg << " jumping\n"; } return z; }

Compilation message (stderr)

/tmp/ccent4at.o: in function `main':
grader.cpp:(.text.startup+0x15e): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x165): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x183): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x18a): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x196): 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+0x1ac): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1b3): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1bf): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1c6): relocation truncated to fit: R_X86_64_PC32 against `.bss'
grader.cpp:(.text.startup+0x1d2): additional relocation overflows omitted from the output
/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1c): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x1c6): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x260): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2e2): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x353): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x541): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5e5): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x670): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x6e9): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
collect2: error: ld returned 1 exit status