답안 #444103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
444103 2021-07-13T06:06:16 Z leinad2 던전 (IOI21_dungeons) C++17
37 / 100
7000 ms 125392 KB
#include "dungeons.h"
#include<bits/stdc++.h>
using namespace std;
int N, i, j, sparse2[400010][20];
long long A[400010], sparse[400010][20];
vector<int>S, P, W, L;
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;W.push_back(N);S.push_back(0);
    for(i=n-1;i>=0;i--)A[i]=A[W[i]]+S[i];
    A[n]=9e18;
    for(i=0;i<=n;i++)sparse[i][0]=A[W[i]]+S[W[i]],sparse2[i][0]=W[i];
    for(j=1;j<20;j++)for(i=0;i<=n;i++)sparse[i][j]=max(sparse[i][j-1], sparse[sparse2[i][j-1]][j-1]),sparse2[i][j]=sparse2[sparse2[i][j-1]][j-1];
}
long long simulate(int x, int Z)
{
    long long z=Z;
    while(x<N)
    {
        if(z<S[x])goto w;
        for(j=19;j>=0;j--)
        {
            if(sparse[x][j]>z+A[x])continue;
            z+=(A[x]-A[sparse2[x][j]]);x=sparse2[x][j];
        }
        w:;
        if(z<S[x])
        {
            z+=P[x];
            x=L[x];
        }
        else
        {
            z+=S[x];
            x=W[x];
        }
    }
    return z;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 2 ms 844 KB Output is correct
4 Correct 46 ms 14784 KB Output is correct
5 Correct 2 ms 844 KB Output is correct
6 Correct 45 ms 14792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 462 ms 116916 KB Output is correct
3 Correct 549 ms 123888 KB Output is correct
4 Correct 439 ms 125392 KB Output is correct
5 Correct 430 ms 125388 KB Output is correct
6 Correct 518 ms 123884 KB Output is correct
7 Correct 424 ms 122120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 77 ms 15544 KB Output is correct
3 Correct 96 ms 15548 KB Output is correct
4 Correct 97 ms 15552 KB Output is correct
5 Correct 84 ms 16572 KB Output is correct
6 Execution timed out 7095 ms 16836 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 77 ms 15544 KB Output is correct
3 Correct 96 ms 15548 KB Output is correct
4 Correct 97 ms 15552 KB Output is correct
5 Correct 84 ms 16572 KB Output is correct
6 Execution timed out 7095 ms 16836 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 77 ms 15544 KB Output is correct
3 Correct 96 ms 15548 KB Output is correct
4 Correct 97 ms 15552 KB Output is correct
5 Correct 84 ms 16572 KB Output is correct
6 Execution timed out 7095 ms 16836 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 588 KB Output is correct
2 Correct 462 ms 116916 KB Output is correct
3 Correct 549 ms 123888 KB Output is correct
4 Correct 439 ms 125392 KB Output is correct
5 Correct 430 ms 125388 KB Output is correct
6 Correct 518 ms 123884 KB Output is correct
7 Correct 424 ms 122120 KB Output is correct
8 Correct 2 ms 588 KB Output is correct
9 Correct 77 ms 15544 KB Output is correct
10 Correct 96 ms 15548 KB Output is correct
11 Correct 97 ms 15552 KB Output is correct
12 Correct 84 ms 16572 KB Output is correct
13 Execution timed out 7095 ms 16836 KB Time limit exceeded
14 Halted 0 ms 0 KB -