Submission #1048294

# Submission time Handle Problem Language Result Execution time Memory
1048294 2024-08-08T06:31:14 Z amirhoseinfar1385 Dungeons Game (IOI21_dungeons) C++17
11 / 100
12 ms 13660 KB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn=400000+10,maxh=10000+10;
long long n,all[maxn],r[maxn],l[maxn],s[maxn],p[maxn],dp[maxn];

void init(int n_, std::vector<int> s_, std::vector<int> p_, std::vector<int> w_, std::vector<int> l_) {
	n=n_;
	for(int i=0;i<n;i++){
		s[i]=s_[i];
		l[i]=l_[i];
		r[i]=w_[i];
		p[i]=p_[i];
	}
	for(int i=n-1;i>=0;i--){
		dp[i]=dp[r[i]]+s[i];
	}
	return;
}

long long simulate(int x, int z) {
	while(z<maxh){
		if(x==n){
			return z;
		}
		if(z>=s[x]){
			z+=s[x];
			x=r[x];
		}else{
			z+=p[x];
			x=l[x];
		}
	}
	z+=dp[x];
	return z;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 8536 KB Output is correct
2 Correct 1 ms 8540 KB Output is correct
3 Correct 1 ms 8540 KB Output is correct
4 Correct 12 ms 13660 KB Output is correct
5 Correct 1 ms 8652 KB Output is correct
6 Correct 11 ms 13404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 8540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 8540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 8540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 8540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 8540 KB Output isn't correct
2 Halted 0 ms 0 KB -