Submission #1049569

# Submission time Handle Problem Language Result Execution time Memory
1049569 2024-08-08T23:29:44 Z vjudge1 Dungeons Game (IOI21_dungeons) C++17
25 / 100
135 ms 188740 KB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
struct level {
	int bj[50100][25];
	long long inc[50100][25];
	long long 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 22876 KB Output is correct
2 Runtime error 17 ms 46144 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 50776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 25180 KB Output is correct
2 Correct 65 ms 91012 KB Output is correct
3 Correct 67 ms 91248 KB Output is correct
4 Correct 62 ms 91988 KB Output is correct
5 Correct 60 ms 91988 KB Output is correct
6 Correct 67 ms 92244 KB Output is correct
7 Correct 66 ms 92264 KB Output is correct
8 Correct 61 ms 91996 KB Output is correct
9 Correct 60 ms 91876 KB Output is correct
10 Correct 61 ms 91884 KB Output is correct
11 Correct 62 ms 92248 KB Output is correct
12 Correct 79 ms 92196 KB Output is correct
13 Correct 75 ms 92252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 25180 KB Output is correct
2 Correct 65 ms 91012 KB Output is correct
3 Correct 67 ms 91248 KB Output is correct
4 Correct 62 ms 91988 KB Output is correct
5 Correct 60 ms 91988 KB Output is correct
6 Correct 67 ms 92244 KB Output is correct
7 Correct 66 ms 92264 KB Output is correct
8 Correct 61 ms 91996 KB Output is correct
9 Correct 60 ms 91876 KB Output is correct
10 Correct 61 ms 91884 KB Output is correct
11 Correct 62 ms 92248 KB Output is correct
12 Correct 79 ms 92196 KB Output is correct
13 Correct 75 ms 92252 KB Output is correct
14 Correct 3 ms 25180 KB Output is correct
15 Correct 64 ms 92484 KB Output is correct
16 Correct 69 ms 92500 KB Output is correct
17 Correct 60 ms 91960 KB Output is correct
18 Correct 75 ms 92224 KB Output is correct
19 Correct 78 ms 92248 KB Output is correct
20 Correct 79 ms 91996 KB Output is correct
21 Correct 79 ms 92140 KB Output is correct
22 Correct 65 ms 91992 KB Output is correct
23 Correct 70 ms 92264 KB Output is correct
24 Correct 94 ms 92248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 25180 KB Output is correct
2 Correct 65 ms 91012 KB Output is correct
3 Correct 67 ms 91248 KB Output is correct
4 Correct 62 ms 91988 KB Output is correct
5 Correct 60 ms 91988 KB Output is correct
6 Correct 67 ms 92244 KB Output is correct
7 Correct 66 ms 92264 KB Output is correct
8 Correct 61 ms 91996 KB Output is correct
9 Correct 60 ms 91876 KB Output is correct
10 Correct 61 ms 91884 KB Output is correct
11 Correct 62 ms 92248 KB Output is correct
12 Correct 79 ms 92196 KB Output is correct
13 Correct 75 ms 92252 KB Output is correct
14 Correct 3 ms 25180 KB Output is correct
15 Correct 64 ms 92484 KB Output is correct
16 Correct 69 ms 92500 KB Output is correct
17 Correct 60 ms 91960 KB Output is correct
18 Correct 75 ms 92224 KB Output is correct
19 Correct 78 ms 92248 KB Output is correct
20 Correct 79 ms 91996 KB Output is correct
21 Correct 79 ms 92140 KB Output is correct
22 Correct 65 ms 91992 KB Output is correct
23 Correct 70 ms 92264 KB Output is correct
24 Correct 94 ms 92248 KB Output is correct
25 Runtime error 135 ms 188740 KB Execution killed with signal 11
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 18 ms 50776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -