Submission #1049566

# Submission time Handle Problem Language Result Execution time Memory
1049566 2024-08-08T23:25:44 Z vjudge1 Dungeons Game (IOI21_dungeons) C++17
0 / 100
21 ms 50780 KB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
struct level {
	int bj[50100][25];
	long long inc[50100][25];
	int strength(int n,int k){
		return inc[n][k];
	}
	int dungeon(int n,int k){
		return bj[n][k];
	}
	void setdungeon(int n,int go,int add){
		inc[n][0]=add;
		bj[n][0]=go;
	}
	void preproc(int n){
		for(int j=1;j<25;j++)
			for(int i=0;i<=n;i++)
				bj[i][j]=bj[bj[i][j-1]][j-1],
				inc[i][j]=inc[i][j-1]+inc[bj[i][j-1]][j-1];
	}
} thgs[6];
map<long long,int>mp;
void init(int n,vector<int> s,vector<int> p,vector<int> w,vector<int> l) {
	for(int i=0;i<n;i++)
		mp[s[i]];
	int CC=0;
	for(auto&[i,j]:mp)
		j=CC++;
	mp[1e18]=CC;
	for(int i=0;i<n;i++)
		for(int j=0;j<6;j++)
			if(j<=mp[s[i]])
				thgs[j].setdungeon(i,l[i],p[i]);
			else thgs[j].setdungeon(i,w[i],s[i]);
	for(int i=0;i<6;i++)
		thgs[i].setdungeon(n,n,0),
		thgs[i].preproc(n);
}

long long simulate(int x, int Z) {
	long long z=Z;
	while(1){
		auto[nxtreq,curlev]=*mp.upper_bound(z);
		if(thgs[curlev].strength(x,24)+z<nxtreq)
			return z+thgs[curlev].strength(x,24);
		for(int i=24;i--;)
			if(thgs[curlev].strength(x,i)+z<nxtreq)
				z+=thgs[curlev].strength(x,i),
				x=thgs[curlev].dungeon(x,i);
		z+=thgs[curlev].strength(x,0);
		x=thgs[curlev].dungeon(x,0);
	}
}

# Verdict Execution time Memory Grader output
1 Correct 2 ms 22872 KB Output is correct
2 Incorrect 2 ms 22876 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 21 ms 50780 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 25224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 25224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 25224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 21 ms 50780 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -