Submission #998419

# Submission time Handle Problem Language Result Execution time Memory
998419 2024-06-14T00:42:24 Z efishel Sprinkler (JOI22_sprinkler) C++17
3 / 100
4000 ms 25544 KB
//Logan/Sprinkler
#include<bits/stdc++.h>
using namespace std;

#define nl '\n'

int N,L,Q,t,a,b;
long long h[200005];
vector<int>ad[200005];

void dfs(int u,int p,int d,int w){
    h[u]=(h[u]*w)%L;
    if(0<d)for(auto v:ad[u])if(v!=p){
        dfs(v,u,d-1,w);
    }
}

int main(){
    cin.tie(0)->sync_with_stdio(0);
    cin>>N>>L;
    for(int i=1;i<N;i++){
        cin>>a>>b;
        ad[a].push_back(b);
        ad[b].push_back(a);
    }
    for(int i=1;i<=N;i++)cin>>h[i];
    cin>>Q;
    for(int i=0;i<Q;i++){
        cin>>t;
        if(t==1){
            cin>>t>>a>>b;
            dfs(t,-1,a,b);
        }else{
            cin>>t;
            cout<<h[t]<<nl;
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Correct 3 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 3 ms 5212 KB Output is correct
5 Correct 3 ms 5240 KB Output is correct
6 Correct 4 ms 5212 KB Output is correct
7 Correct 7 ms 5212 KB Output is correct
8 Correct 4 ms 5212 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 4956 KB Output is correct
14 Correct 2 ms 4952 KB Output is correct
15 Correct 3 ms 5168 KB Output is correct
16 Correct 2 ms 5180 KB Output is correct
17 Correct 1 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 5172 KB Output is correct
20 Correct 3 ms 4956 KB Output is correct
21 Correct 3 ms 4952 KB Output is correct
22 Correct 3 ms 4956 KB Output is correct
23 Correct 2 ms 4956 KB Output is correct
24 Correct 2 ms 5164 KB Output is correct
25 Correct 2 ms 4952 KB Output is correct
26 Correct 2 ms 4956 KB Output is correct
27 Correct 3 ms 4956 KB Output is correct
28 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 133 ms 23200 KB Output is correct
3 Correct 180 ms 24896 KB Output is correct
4 Correct 147 ms 24660 KB Output is correct
5 Correct 152 ms 24652 KB Output is correct
6 Correct 154 ms 24148 KB Output is correct
7 Correct 144 ms 24932 KB Output is correct
8 Correct 138 ms 25544 KB Output is correct
9 Correct 133 ms 24464 KB Output is correct
10 Correct 164 ms 24716 KB Output is correct
11 Correct 125 ms 24684 KB Output is correct
12 Correct 146 ms 24912 KB Output is correct
13 Execution timed out 4064 ms 18156 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 133 ms 23200 KB Output is correct
3 Correct 180 ms 24896 KB Output is correct
4 Correct 147 ms 24660 KB Output is correct
5 Correct 152 ms 24652 KB Output is correct
6 Correct 154 ms 24148 KB Output is correct
7 Correct 144 ms 24932 KB Output is correct
8 Correct 138 ms 25544 KB Output is correct
9 Correct 133 ms 24464 KB Output is correct
10 Correct 164 ms 24716 KB Output is correct
11 Correct 125 ms 24684 KB Output is correct
12 Correct 146 ms 24912 KB Output is correct
13 Execution timed out 4064 ms 18156 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 314 ms 20292 KB Output is correct
3 Correct 1386 ms 20560 KB Output is correct
4 Correct 463 ms 20308 KB Output is correct
5 Correct 2194 ms 20352 KB Output is correct
6 Execution timed out 4019 ms 16976 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 261 ms 22832 KB Output is correct
3 Correct 1315 ms 20904 KB Output is correct
4 Correct 503 ms 21588 KB Output is correct
5 Correct 1973 ms 21908 KB Output is correct
6 Execution timed out 4090 ms 16888 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4956 KB Output is correct
2 Correct 3 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 3 ms 5212 KB Output is correct
5 Correct 3 ms 5240 KB Output is correct
6 Correct 4 ms 5212 KB Output is correct
7 Correct 7 ms 5212 KB Output is correct
8 Correct 4 ms 5212 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 1 ms 4956 KB Output is correct
14 Correct 2 ms 4952 KB Output is correct
15 Correct 3 ms 5168 KB Output is correct
16 Correct 2 ms 5180 KB Output is correct
17 Correct 1 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 5172 KB Output is correct
20 Correct 3 ms 4956 KB Output is correct
21 Correct 3 ms 4952 KB Output is correct
22 Correct 3 ms 4956 KB Output is correct
23 Correct 2 ms 4956 KB Output is correct
24 Correct 2 ms 5164 KB Output is correct
25 Correct 2 ms 4952 KB Output is correct
26 Correct 2 ms 4956 KB Output is correct
27 Correct 3 ms 4956 KB Output is correct
28 Correct 2 ms 4956 KB Output is correct
29 Correct 2 ms 4956 KB Output is correct
30 Correct 133 ms 23200 KB Output is correct
31 Correct 180 ms 24896 KB Output is correct
32 Correct 147 ms 24660 KB Output is correct
33 Correct 152 ms 24652 KB Output is correct
34 Correct 154 ms 24148 KB Output is correct
35 Correct 144 ms 24932 KB Output is correct
36 Correct 138 ms 25544 KB Output is correct
37 Correct 133 ms 24464 KB Output is correct
38 Correct 164 ms 24716 KB Output is correct
39 Correct 125 ms 24684 KB Output is correct
40 Correct 146 ms 24912 KB Output is correct
41 Execution timed out 4064 ms 18156 KB Time limit exceeded
42 Halted 0 ms 0 KB -