제출 #1345723

#제출 시각아이디문제언어결과실행 시간메모리
1345723thesentro트리 (IOI24_tree)C++20
컴파일 에러
0 ms0 KiB
#include "tree.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int n;
std::vector<int> p, w;

void init(std::vector<int> P, std::vector<int> W) {
    p = P;
    w = W;
    n = (int)p.size();
    for (int i=1 ; i<n ; i++)
    {
        g[i].push_back(p[i]);
        g[p[i]].push_back(i);
    }
}

long long query(int L, int R) {
    return L;
}

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

tree.cpp: In function 'void init(std::vector<int>, std::vector<int>)':
tree.cpp:14:9: error: 'g' was not declared in this scope
   14 |         g[i].push_back(p[i]);
      |         ^