answer.code:4:14: error: ‘MAXN’ was not declared in this scope
4 | vector<int>g[MAXN];
| ^~~~
answer.code:6:7: error: ‘MAXN’ was not declared in this scope
6 | int a[MAXN];
| ^~~~
answer.code:7:7: error: ‘MAXN’ was not declared in this scope
7 | int f[MAXN], sum[MAXN], t[MAXN];
| ^~~~
answer.code:7:18: error: ‘MAXN’ was not declared in this scope
7 | int f[MAXN], sum[MAXN], t[MAXN];
| ^~~~
answer.code:7:27: error: ‘MAXN’ was not declared in this scope
7 | int f[MAXN], sum[MAXN], t[MAXN];
| ^~~~
answer.code: In function ‘void dfs(int, int)’:
answer.code:11:22: error: ‘g’ was not declared in this scope
11 | for (int v : g[u]) {
| ^
answer.code:14:17: error: ‘sum’ was not declared in this scope
14 | sum[u] += f[v];
| ^~~
answer.code:14:27: error: ‘f’ was not declared in this scope
14 | sum[u] += f[v];
| ^
answer.code:15:30: error: ‘a’ was not declared in this scope
15 | mx = max(mx, a[v]);//找到a[v]的最大值
| ^
answer.code:16:21: error: ‘t’ was not declared in this scope
16 | if (t[v] == 3)st.insert(a[v]);//把t[v] = 3 的点放进来
| ^
answer.code:18:9: error: ‘f’ was not declared in this scope
18 | f[u] = sum[u] + mx;
| ^
answer.code:18:16: error: ‘sum’ was not declared in this scope
18 | f[u] = sum[u] + mx;
| ^~~
answer.code:19:20: error: ‘INF’ was not declared in this scope
19 | st.insert(-INF);
| ^~~
answer.code:20:22: error: ‘g’ was not declared in this scope
20 | for (int v : g[u]) {
| ^
answer.code:22:21: error: ‘t’ was not declared in this scope
22 | if (t[v] == 3)st.erase(st.find(a[v]));
| ^
answer.code:22:48: error: ‘a’ was not declared in this scope
22 | if (t[v] == 3)st.erase(st.find(a[v]));
| ^
answer.code:23:49: error: ‘a’ was not declared in this scope
23 | f[u] = max(f[u],sum[u] - f[v] + a[v] + sum[v] + *st.rbegin());
| ^
answer.code:24:21: error: ‘t’ was not declared in this scope
24 | if (t[v] == 3)st.insert(a[v]);//注意不要忘了添加回去
| ^
answer.code: In function ‘void slove()’:
answer.code:29:37: error: ‘g’ was not declared in this scope
29 | for (int i = 1; i <= n; i++)g[i].clear(), f[i] = sum[i] = 0;
| ^
answer.code:29:51: error: ‘f’ was not declared in this scope
29 | for (int i = 1; i <= n; i++)g[i].clear(), f[i] = sum[i] = 0;
| ^
answer.code:29:58: error: ‘sum’ was not declared in this scope
29 | for (int i = 1; i <= n; i++)g[i].clear(), f[i] = sum[i] = 0;
| ^~~
answer.code:30:44: error: ‘a’ was not declared in this scope
30 | for (int i = 1; i <= n; i++)cin >> a[i];
| ^
answer.code:31:44: error: ‘t’ was not declared in this scope
31 | for (int i = 1; i <= n; i++)cin >> t[i];
| ^
answer.code:34:17: error: ‘g’ was not declared in this scope
34 | g[u].push_back(v);
| ^
answer.code:38:17: error: ‘f’ was not declared in this scope
38 | cout << f[1] + a[1] << endl;
| ^
answer.code:38:24: error: ‘a’ was not declared in this scope
38 | cout << f[1] + a[1] << endl;
| ^