#include <iostream>
#include <vector>
#define f first
#define s second
#define int long long
using namespace std;
int n, mod, a[200010], cnt;
pair<int,int> rng[200010];
vector<int> edge[200010], d[200010], node[200010];
void dfs(int u, int v, int depth) {
rng[u].f = ++cnt;
d[depth].push_back(u);
for (int i = 0; i < edge[u].size(); i++) if (edge[u][i] != v) dfs(edge[u][i],u,depth+1);
rng[u].s = cnt;
}
void build(int i, int id, int x, int y) {
if (x == y) {
node[i][id] = a[d[i][x]];
return;
}
int mid = (x+y)/2;
build(i,id*2,x,mid);
build(i,id*2+1,mid+1,y);
node[i][id] = 1;
}
void update(int i, int id, int x, int y, int l, int r, int val) {
if ((l <= x) && (y <= r)) {
}
}
signed main() {
cin >> n >> mod;
for (int i = 1; i < n; i++) {
int u, v;
cin >> u >> v;
edge[u].push_back(v);
edge[v].push_back(u);
}
for (int i = 1; i <= n; i++) cin >> a[i];
dfs(1,0,1);
for (int i = 1; i <= n; i++) {
if (d[i].size()) {
node[i].resize(d[i].size()*4+10);
build(i,1,0,d[i].size()-1);
}
}
cin >> test;
while (test--) {
int type, u, dis, val;
cin >> type;
if (type == 1) {
cin >> u >> dis >> val;
} else {
cin >> u;
}
}
}
Compilation message
sprinkler.cpp: In function 'void dfs(long long int, long long int, long long int)':
sprinkler.cpp:15:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
15 | for (int i = 0; i < edge[u].size(); i++) if (edge[u][i] != v) dfs(edge[u][i],u,depth+1);
| ~~^~~~~~~~~~~~~~~~
sprinkler.cpp: In function 'int main()':
sprinkler.cpp:52:9: error: 'test' was not declared in this scope
52 | cin >> test;
| ^~~~