Submission #1045983

# Submission time Handle Problem Language Result Execution time Memory
1045983 2024-08-06T08:49:28 Z Unforgettablepl Dungeons Game (IOI21_dungeons) C++17
13 / 100
87 ms 23620 KB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;

const int INF = 1e8;

vector<int> s,p,w,l;
vector<vector<int>> lift;
vector<vector<long long>> liftcost;
vector<long long> bestans;
int n;

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;
	lift = vector(n+1,vector(24,0));
	liftcost = vector(n+1,vector(24,0ll));
	bestans = vector(n+1,0ll);
	for(int i=n-1;i>=0;i--){
		bestans[i]=bestans[w[i]]+s[i];
		lift[i][0] = l[i];
		liftcost[i][0] = p[i];
	}
	liftcost[n][0]=INF;
	lift[n][0]=n;
	for(int bit=1;bit<24;bit++){
		for(int i=0;i<=n;i++){
			lift[i][bit]=lift[lift[i][bit-1]][bit-1];
			liftcost[i][bit]=liftcost[i][bit-1]+liftcost[lift[i][bit-1]][bit-1];
		}
	}
	return;
}

long long simulate(int x,int z){
	for(int bit=23;bit>=0;bit--){
		if(z+liftcost[x][bit]<s[0]){
			z+=liftcost[x][bit];
			x=lift[x][bit];
		}
	}
	if(x==n)return z;
	if(z<s[0]){
		z+=liftcost[x][0];
		x = lift[x][0];
	}
	return z+bestans[x];
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 45 ms 23596 KB Output is correct
3 Correct 73 ms 23620 KB Output is correct
4 Correct 39 ms 22948 KB Output is correct
5 Correct 41 ms 22872 KB Output is correct
6 Correct 72 ms 23244 KB Output is correct
7 Correct 44 ms 23132 KB Output is correct
8 Correct 35 ms 22808 KB Output is correct
9 Correct 39 ms 22872 KB Output is correct
10 Correct 36 ms 22616 KB Output is correct
11 Correct 52 ms 23128 KB Output is correct
12 Correct 87 ms 23136 KB Output is correct
13 Correct 67 ms 23128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 45 ms 23596 KB Output is correct
3 Correct 73 ms 23620 KB Output is correct
4 Correct 39 ms 22948 KB Output is correct
5 Correct 41 ms 22872 KB Output is correct
6 Correct 72 ms 23244 KB Output is correct
7 Correct 44 ms 23132 KB Output is correct
8 Correct 35 ms 22808 KB Output is correct
9 Correct 39 ms 22872 KB Output is correct
10 Correct 36 ms 22616 KB Output is correct
11 Correct 52 ms 23128 KB Output is correct
12 Correct 87 ms 23136 KB Output is correct
13 Correct 67 ms 23128 KB Output is correct
14 Incorrect 1 ms 856 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 45 ms 23596 KB Output is correct
3 Correct 73 ms 23620 KB Output is correct
4 Correct 39 ms 22948 KB Output is correct
5 Correct 41 ms 22872 KB Output is correct
6 Correct 72 ms 23244 KB Output is correct
7 Correct 44 ms 23132 KB Output is correct
8 Correct 35 ms 22808 KB Output is correct
9 Correct 39 ms 22872 KB Output is correct
10 Correct 36 ms 22616 KB Output is correct
11 Correct 52 ms 23128 KB Output is correct
12 Correct 87 ms 23136 KB Output is correct
13 Correct 67 ms 23128 KB Output is correct
14 Incorrect 1 ms 856 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 860 KB Output isn't correct
2 Halted 0 ms 0 KB -