Submission #879783

# Submission time Handle Problem Language Result Execution time Memory
879783 2023-11-28T06:11:15 Z abcvuitunggio Dungeons Game (IOI21_dungeons) C++17
24 / 100
7000 ms 186800 KB
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
const int sz=23;
struct B{
    int u=-1;
    long long mx=0,mn=0,sum=0;
}nxt[50001][sz][2];
B operator +(B a, B b){
    return {b.u,max(a.mx,b.mx-a.sum),min(a.mn,b.mn-a.sum),a.sum+b.sum};
}
vector <int> S,P;
void init(int n, vector <int> s, vector <int> p, vector <int> w, vector <int> l){
    S=s;
    P=p;
    for (int i=0;i<n;i++){
        nxt[i][0][0]={w[i],s[i],s[i],s[i]};
        nxt[i][0][1]={l[i],s[i],s[i],p[i]};
    }
    for (int j=1;j<sz;j++){
        for (int i=0;i<n;i++)
            for (int k=0;k<2;k++){
                if (nxt[i][j-1][k].u==-1)
                    continue;
                nxt[i][j][k]=nxt[i][j-1][k]+nxt[nxt[i][j-1][k].u][j-1][k];
            }
    }
}
long long simulate(int x, int Z){
    int b=0;
    long long z=Z;
    while (true){
        if (nxt[x][0][0].u==-1)
            return z;
        for (int i=sz-1;i>=0;i--)
            if (nxt[x][i][b].u!=-1)
                if ((b&&z<nxt[x][i][b].mn)||(!b&&z>=nxt[x][i][b].mx)){
                    z+=nxt[x][i][b].sum;
                    x=nxt[x][i][b].u;
                }

        b^=1;
    }
	return z;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 2 ms 3416 KB Output is correct
4 Correct 70 ms 75344 KB Output is correct
5 Correct 3 ms 3416 KB Output is correct
6 Correct 70 ms 75096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1880 KB Output is correct
2 Runtime error 223 ms 186800 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1880 KB Output is correct
2 Correct 100 ms 76864 KB Output is correct
3 Correct 118 ms 76864 KB Output is correct
4 Correct 106 ms 76352 KB Output is correct
5 Correct 104 ms 76200 KB Output is correct
6 Correct 101 ms 76368 KB Output is correct
7 Correct 104 ms 76368 KB Output is correct
8 Correct 109 ms 76112 KB Output is correct
9 Correct 101 ms 76368 KB Output is correct
10 Correct 125 ms 75856 KB Output is correct
11 Correct 116 ms 76372 KB Output is correct
12 Correct 330 ms 76460 KB Output is correct
13 Correct 318 ms 76368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1880 KB Output is correct
2 Correct 100 ms 76864 KB Output is correct
3 Correct 118 ms 76864 KB Output is correct
4 Correct 106 ms 76352 KB Output is correct
5 Correct 104 ms 76200 KB Output is correct
6 Correct 101 ms 76368 KB Output is correct
7 Correct 104 ms 76368 KB Output is correct
8 Correct 109 ms 76112 KB Output is correct
9 Correct 101 ms 76368 KB Output is correct
10 Correct 125 ms 75856 KB Output is correct
11 Correct 116 ms 76372 KB Output is correct
12 Correct 330 ms 76460 KB Output is correct
13 Correct 318 ms 76368 KB Output is correct
14 Correct 2 ms 1880 KB Output is correct
15 Correct 221 ms 76572 KB Output is correct
16 Correct 99 ms 76624 KB Output is correct
17 Correct 102 ms 76352 KB Output is correct
18 Correct 103 ms 76352 KB Output is correct
19 Correct 104 ms 76368 KB Output is correct
20 Correct 125 ms 76112 KB Output is correct
21 Correct 109 ms 76112 KB Output is correct
22 Execution timed out 7017 ms 76112 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1880 KB Output is correct
2 Correct 100 ms 76864 KB Output is correct
3 Correct 118 ms 76864 KB Output is correct
4 Correct 106 ms 76352 KB Output is correct
5 Correct 104 ms 76200 KB Output is correct
6 Correct 101 ms 76368 KB Output is correct
7 Correct 104 ms 76368 KB Output is correct
8 Correct 109 ms 76112 KB Output is correct
9 Correct 101 ms 76368 KB Output is correct
10 Correct 125 ms 75856 KB Output is correct
11 Correct 116 ms 76372 KB Output is correct
12 Correct 330 ms 76460 KB Output is correct
13 Correct 318 ms 76368 KB Output is correct
14 Correct 2 ms 1880 KB Output is correct
15 Correct 221 ms 76572 KB Output is correct
16 Correct 99 ms 76624 KB Output is correct
17 Correct 102 ms 76352 KB Output is correct
18 Correct 103 ms 76352 KB Output is correct
19 Correct 104 ms 76368 KB Output is correct
20 Correct 125 ms 76112 KB Output is correct
21 Correct 109 ms 76112 KB Output is correct
22 Execution timed out 7017 ms 76112 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1880 KB Output is correct
2 Runtime error 223 ms 186800 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -