QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#696739 | #9238. Tree | ivan_alexeev# | Compile Error | / | / | C++23 | 599b | 2024-11-01 00:58:41 | 2024-11-01 00:58:42 |
Judging History
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);
}
詳細信息
/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