제출 #617550

#제출 시각아이디문제언어결과실행 시간메모리
617550SlavicG던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.h"
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
const int N = 4e5 + 10, K = 20;
int jump[N][K], jump2[N][K], finish;
ll sum[N][K], S[N], P[N], W[N], L[N];
void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
    finish = n;
	for(int i = 0; i < N; ++i) {
        for(int j = 0; j < K; ++j) jump1[i][j] = jump2[i][j] = n;
	}

	for(int i = 0; i < n; ++i) {
        S[i] = s[i];
        P[i] = p[i];
        W[i] = w[i];
        L[i] = l[i];
        jump[i][0] = l[i];
        sum[i][0] = p[i];
        jump2[i][0] = w[i];
	}
	for(int j = 1; j < K; ++j) {
        for(int i = 0; i < n; ++i) {
            jump[i][j] = jump[jump[i][j - 1]][j - 1];
            jump2[i][j] = jump2[jump2[i][j - 1]][j - 1];
            sum[i][j] = sum[i][j - 1] + sum[sum[i][j - 1]][j - 1];
        }
	}
}

long long simulate(int x, int z) {
    ll w = z;
    for(int j = K - 1; j >= 0; --j) {
        if(w + sum[x][j] < S[0] && jump[x][j] != finish) {
            w += sum[x][j];
            x = jump[x][j];
        }
    }
    if(w < sum[x][0]) {
        w += sum[x][0];
        x = jump[x][0];
    }
    ll steps = 0;
    for(int j = K - 1; j >= 0; --j) {
        if(jump2[x][j] != finish) {
            steps += (1 << j);
            x = jump2[x][j];
        }
    }
    ++steps;
    w += steps * S[0];
    return w;
}

컴파일 시 표준 에러 (stderr) 메시지

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:12:36: error: 'jump1' was not declared in this scope; did you mean 'jump2'?
   12 |         for(int j = 0; j < K; ++j) jump1[i][j] = jump2[i][j] = n;
      |                                    ^~~~~
      |                                    jump2