Submission #443535

#TimeUsernameProblemLanguageResultExecution timeMemory
443535JvThunderDungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include "dungeons.h" #include <bits/stdc++.h> #define fr first #define sc second typedef long long ll; using namespace std; int bs = 5; const int nop = 5; const int noa = 19; int INF = 1e9+7; ll add[400005] = {0}; pair<int,pair<int,ll>> jump[nop][noa][400005]; int N; vector<int> S,P,W,L; void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) { S = s; P = p; W = w; L = l; N = n; S.push_back(INF); P.push_back(INF); W.push_back(n); L.push_back(n); for(int i=n-1; i>=0; i--) add[i] = add[W[i]] + S[i]; for(int ph=0; ph<nop; ph++) { ll l = 1<<(bs*ph); ll r = 1<<(bs*(ph+1)); for(int i=0; i<=n; i++) { if ((l<S[i] && S[i]<r) || i==n) jump[ph][0][i] = {L[i], {S[i], P[i]}}; else if (S[i]<=l) jump[ph][0][i] = {W[i], {INF, S[i]}}; else jump[ph][0][i] = {L[i], {INF, P[i]}}; } for(int b=1; b<noa; b++) { for (int i=0; i<=n; i++) { int pos = i; ll min_S = INF, str_add = 0; for (int it=0; it<2; it++) { auto pr = jump[ph][b-1][pos]; min_S = min(min_S, pr.sc.fr-str_add); str_add += pr.sc.sc; pos = pr.frst; } jump[ph][b][i] = {pos, {min_S, str_add}}; } } } return; } ll simulate(int x, int z) { int pos = x; ll str = z; for(int a=0; a<nop; a++) { ll l = 1<<(bs*a); ll r = 1<<(bs*(a+1)); while(pos!=N && l<=str && str<r) { for(int b=noa-1; b>=0; b--) { while(str+jump[a][b][pos].sc.sc < r && str-jump[a][b][pos].sc.fr < 0) { str += jump[a][b][pos].sc.sc; pos = jump[a][b][pos].fr; } } if(pos!=N) { if(str>=S[pos]) str += S[pos], pos = W[pos]; else str += P[pos], pos = L[pos]; } } } str += add[pos]; return str; }

Compilation message (stderr)

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:52:15: error: 'struct std::pair<int, std::pair<int, long long int> >' has no member named 'frst'; did you mean 'first'?
   52 |      pos = pr.frst;
      |               ^~~~
      |               first