Submission #1046212

# Submission time Handle Problem Language Result Execution time Memory
1046212 2024-08-06T11:44:52 Z VMaksimoski008 Dungeons Game (IOI21_dungeons) C++17
11 / 100
7000 ms 19784 KB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int maxn = 4e5 + 5;
vector<int> S, P, W, L;
int N;

void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
    N = n;
    S = s;
    P = p;
    W = w;
    L = l;
	return;
}

long long simulate(int x, int z) {
    ll ans = z;
    while(x != N) {
        if(z >= S[x]) {
            z += S[x];
            x = W[x];
        } else {
            z += P[x];
            x = L[x];
        }
    }
	return z;
}

Compilation message

dungeons.cpp: In function 'long long int simulate(int, int)':
dungeons.cpp:20:8: warning: unused variable 'ans' [-Wunused-variable]
   20 |     ll ans = z;
      |        ^~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 10 ms 2776 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 10 ms 2708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Execution timed out 7094 ms 19784 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 21 ms 3420 KB Output is correct
3 Execution timed out 7064 ms 3420 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 21 ms 3420 KB Output is correct
3 Execution timed out 7064 ms 3420 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 21 ms 3420 KB Output is correct
3 Execution timed out 7064 ms 3420 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Execution timed out 7094 ms 19784 KB Time limit exceeded
3 Halted 0 ms 0 KB -