답안 #950272

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
950272 2024-03-20T07:31:04 Z 12345678 던전 (IOI21_dungeons) C++17
0 / 100
37 ms 15708 KB
#include "dungeons.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=5e4+5, kx=16;

ll N, S, loc[nx][kx], c[nx][kx], dp[nx];

void init(int n, std::vector<int> s, std::vector<int> p, std::vector<int> w, std::vector<int> l) {
    N=n;
    S=s[0];
    for (int i=0; i<n; i++) c[i][0]=p[i], loc[i][0]=l[i];
    loc[n][0]=n;
    for (int i=1; i<kx; i++) for (int j=0; j<=n; j++) loc[j][i]=loc[loc[j][i-1]][i-1], c[j][i]=c[j][i-1]+c[loc[j][i-1]][i-1];
    //for (int i=0; i<kx; i++) for (int j=0; j<=n; j++) cout<<i<<' '<<j<<' '<<loc[j][i]<<' '<<c[j][i]<<'\n';
    for (int i=n-1; i>=0; i--) dp[i]=dp[w[i]]+s[i];
}

long long simulate(int x, int z) {
    if (z>=S) return (ll)z+dp[x];
    ll pw=z, cl=x;
    for (int i=kx-1; i>=0; i--) if (c[cl][i]+pw<S) pw+=c[cl][i], cl=loc[cl][i];
    pw+=c[cl][0];
    cl=loc[cl][0];
    return pw+dp[cl];
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Incorrect 1 ms 4444 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 35 ms 15624 KB Output is correct
3 Correct 34 ms 15584 KB Output is correct
4 Correct 34 ms 15708 KB Output is correct
5 Correct 31 ms 15708 KB Output is correct
6 Incorrect 37 ms 15704 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 35 ms 15624 KB Output is correct
3 Correct 34 ms 15584 KB Output is correct
4 Correct 34 ms 15708 KB Output is correct
5 Correct 31 ms 15708 KB Output is correct
6 Incorrect 37 ms 15704 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4444 KB Output is correct
2 Correct 35 ms 15624 KB Output is correct
3 Correct 34 ms 15584 KB Output is correct
4 Correct 34 ms 15708 KB Output is correct
5 Correct 31 ms 15708 KB Output is correct
6 Incorrect 37 ms 15704 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -