#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define keish ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
int n, l, q, u, v, t, x, d, w, lim;
vector<int> con[1005][1005];
signed main(){
keish;
cin >> n >> l;
vector<vector<int>> e(n);
for(int i = 1; i < n; i++){
cin >> u >> v; u--, v--;
e[u].push_back(v);
e[v].push_back(u);
}
vector<int> a(n);
for(auto &x : a) cin >> x;
cin >> q;
while(q--){
cin >> t;
if(t == 1){
cin >> x >> d >> w; x--;
(a[x] *= w) %= l;
for(auto v : e[u]){
(a[v] *= w) %= l;
}
}else{
cin >> x; x--;
cout << a[x] << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
24020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
23928 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
23928 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
24020 KB |
Output is correct |
2 |
Incorrect |
155 ms |
40008 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
24020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
24020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |