QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#696739#9238. Treeivan_alexeev#Compile Error//C++23599b2024-11-01 00:58:412024-11-01 00:58:42

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 00:58:42]
  • 评测
  • [2024-11-01 00:58:41]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#ifdef lisie_bimbi
#else
#define endl '\n'
#endif
typedef long long ll;

#define int long long

const ll inf = 1'000'000'000;
int n;
vector<vector<int>> v;
vector<int> w;
int l, r;

int dfs(int u, int l, int r){
    int sum = 0;
    int ans = 0;
    for(auto i : v[u]){
        ans += dfs(i, l, r);
        sum += r;
    }
    ans += w[u] * (r - sum);
    return ans;
}

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

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

Details

/usr/bin/ld: /tmp/ccTYeMCl.o: in function `main':
implementer.cpp:(.text.startup+0x2e6): undefined reference to `init(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: implementer.cpp:(.text.startup+0x399): undefined reference to `query(int, int)'
collect2: error: ld returned 1 exit status