Submission #1011099

# Submission time Handle Problem Language Result Execution time Memory
1011099 2024-06-29T19:53:17 Z 1ne Dungeons Game (IOI21_dungeons) C++17
0 / 100
1 ms 1372 KB
#include "dungeons.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int k = 20;
vector<vector<int>>table;
vector<vector<int>>nx;
vector<vector<int>>sum;
vector<int>S,P,W,L;
int N;	
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
	table.resize(n,vector<int>(k));
	nx.resize(n,vector<int>(k,-1));
	sum.resize(n,vector<int>(k,0));
	N = n;
	S = s;
	P = p;
	W = w;
	L = l;
	for (int i = 0;i<n;++i){
		table[i][0] = s[i];
		nx[i][0] = w[i];
		sum[i][0] = s[i];
	}
	for (int i = 1;i<k;++i){
	
			for (int j = 0;j<n;++j){
			if (nx[j][i - 1] == -1)continue;
			nx[j][i] = nx[nx[j][i - 1]][i - 1];
			table[j][i] = max(table[j][i - 1],table[nx[j][i - 1]][i - 1] - sum[j][i - 1]);
			sum[j][i] = sum[j][i - 1] + sum[nx[j][i - 1]][i - 1];
		}
	}
	return;
}

long long simulate(int x, int z) {
	long long Z = z;
	while(x != N){
		int c = 0;
		while(nx[x][c] != -1 && table[x][c] <= z){
			++c;
		}
		if (c != 0){
			Z+=sum[x][c - 1];
			x = nx[x][c - 1];
		}
		if (x != N){
			Z+=P[x];
			x = L[x];
		}	
	}
	return Z;
}

# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1284 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1372 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1372 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1372 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 1284 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -