# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1056258 | Huseyn123 | Dungeons Game (IOI21_dungeons) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "dungeons.h"
#define INF LLONG_MAX
using namespace std;
typedef long long ll;
const int lg=25;
ll st[3][lg][lg][400001];
vector<int> S,P,W,L;
int N;
void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
s.push_back(0);
N=n;
S=s;
P=p;
W=w;
L=l;
for(int i=0;i<lg;i++){
for(int z=0;z<n;z++){
if(s[z]<(1<<i)){
st[0][i][0][z]=s[z];
if(w[z]!=n && s[w[z]]<(1<<i)){
st[1][i][0][z]=-INF;
}
else{
st[1][i][0][z]=s[z]-s[w[z]];
}
st[2][i][0][z]=w[z];
}
else{
st[0][i][0][z]=p[z];