#include "dungeons.h"
#include <vector>
using namespace std;
// vector s contienes la fuerza en i y es igual a la recompensa
// vector p contiene la recompensa por perder
// w donde vas despues de ganar
// l donde vas despues de perder
vector<int> fuerza;
vector<int> consuelo;
vector<int> ganar;
vector<int> perder;
int habitaciones;
void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
fuerza = s;
consuelo = p;
ganar = w;
perder = l;
habitaciones = s.size() + 1;
return;
}
long long simulate(int x, int z) {
int actual = x;
long long fuerzayo = z;
while (actual != habitaciones)
{
if (fuerzayo >= fuerza[actual])
{
fuerzayo += fuerza[actual];
actual = ganar[actual];
}else if (fuerzayo < fuerza[actual])
{
fuerzayo += consuelo[actual];
actual = perder[actual];
}
}
return fuerzayo;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7068 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7028 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7086 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7086 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7086 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
7028 ms |
332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |