#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;
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;
if(d == 1){
for(auto v : e[x]){
(a[v] *= w) %= l;
}
}
}else{
cin >> x; x--;
cout << a[x] << '\n';
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
189 ms |
17400 KB |
Output is correct |
3 |
Correct |
193 ms |
14264 KB |
Output is correct |
4 |
Correct |
172 ms |
14740 KB |
Output is correct |
5 |
Correct |
180 ms |
15880 KB |
Output is correct |
6 |
Correct |
177 ms |
15732 KB |
Output is correct |
7 |
Correct |
174 ms |
16164 KB |
Output is correct |
8 |
Correct |
169 ms |
16304 KB |
Output is correct |
9 |
Correct |
151 ms |
16168 KB |
Output is correct |
10 |
Correct |
190 ms |
13164 KB |
Output is correct |
11 |
Correct |
172 ms |
17416 KB |
Output is correct |
12 |
Correct |
192 ms |
14144 KB |
Output is correct |
13 |
Execution timed out |
4054 ms |
14264 KB |
Time limit exceeded |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
189 ms |
17400 KB |
Output is correct |
3 |
Correct |
193 ms |
14264 KB |
Output is correct |
4 |
Correct |
172 ms |
14740 KB |
Output is correct |
5 |
Correct |
180 ms |
15880 KB |
Output is correct |
6 |
Correct |
177 ms |
15732 KB |
Output is correct |
7 |
Correct |
174 ms |
16164 KB |
Output is correct |
8 |
Correct |
169 ms |
16304 KB |
Output is correct |
9 |
Correct |
151 ms |
16168 KB |
Output is correct |
10 |
Correct |
190 ms |
13164 KB |
Output is correct |
11 |
Correct |
172 ms |
17416 KB |
Output is correct |
12 |
Correct |
192 ms |
14144 KB |
Output is correct |
13 |
Execution timed out |
4054 ms |
14264 KB |
Time limit exceeded |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |