Submission #588788

# Submission time Handle Problem Language Result Execution time Memory
588788 2022-07-04T04:53:06 Z Tekor Sprinkler (JOI22_sprinkler) C++17
3 / 100
4000 ms 16888 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define f first
#define s second
#define pii pair <int,int>
#define en '\n'
void boos() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
const int N = 2e5 + 100;
vector <int> g[N];
ll a[N],L;
int n;
void dfs(int v,int p,int d,ll val) {
	a[v] = (a[v] * val) % L;
	if(d == 0)return;
	for(auto to : g[v]) {
		if(to == p)continue;
		dfs(to,v,d - 1,val);
	}
}
void solve() {
	cin >> n >> L;
	for(int i = 1;i < n;i++) {
		int x,y;
		cin >> x >> y;
		g[x].pb(y);
		g[y].pb(x);
	}
	for(int i = 1;i <= n;i++)cin >> a[i];
	int q;
	cin >> q;
	for(int i = 1;i <= q;i++) {
		int typ;
		cin >> typ;
		if(typ == 1) {
			int x,d;
			ll w;
			cin >> x >> d >> w;
			dfs(x,-1,d,w);
		}else {
			int x;
			cin >> x;
			cout << a[x] << en;
		}
	}
}

int main() {
	boos();
	int ttt;
	ttt = 1;
	while(ttt--) {
		solve();
	}
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 4 ms 4948 KB Output is correct
4 Correct 5 ms 5032 KB Output is correct
5 Correct 7 ms 5076 KB Output is correct
6 Correct 11 ms 5092 KB Output is correct
7 Correct 9 ms 5096 KB Output is correct
8 Correct 7 ms 5076 KB Output is correct
9 Correct 3 ms 5028 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 4 ms 5032 KB Output is correct
14 Correct 4 ms 4936 KB Output is correct
15 Correct 4 ms 5028 KB Output is correct
16 Correct 4 ms 4948 KB Output is correct
17 Correct 3 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 4 ms 4948 KB Output is correct
20 Correct 3 ms 5024 KB Output is correct
21 Correct 3 ms 4976 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 3 ms 4980 KB Output is correct
24 Correct 3 ms 4948 KB Output is correct
25 Correct 3 ms 4948 KB Output is correct
26 Correct 3 ms 5004 KB Output is correct
27 Correct 3 ms 5032 KB Output is correct
28 Correct 3 ms 4948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 220 ms 16848 KB Output is correct
3 Correct 299 ms 13620 KB Output is correct
4 Correct 244 ms 15252 KB Output is correct
5 Correct 262 ms 15380 KB Output is correct
6 Correct 238 ms 15500 KB Output is correct
7 Correct 270 ms 15572 KB Output is correct
8 Correct 199 ms 16280 KB Output is correct
9 Correct 285 ms 16664 KB Output is correct
10 Correct 306 ms 13688 KB Output is correct
11 Correct 244 ms 16888 KB Output is correct
12 Correct 325 ms 13984 KB Output is correct
13 Execution timed out 4057 ms 13944 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 220 ms 16848 KB Output is correct
3 Correct 299 ms 13620 KB Output is correct
4 Correct 244 ms 15252 KB Output is correct
5 Correct 262 ms 15380 KB Output is correct
6 Correct 238 ms 15500 KB Output is correct
7 Correct 270 ms 15572 KB Output is correct
8 Correct 199 ms 16280 KB Output is correct
9 Correct 285 ms 16664 KB Output is correct
10 Correct 306 ms 13688 KB Output is correct
11 Correct 244 ms 16888 KB Output is correct
12 Correct 325 ms 13984 KB Output is correct
13 Execution timed out 4057 ms 13944 KB Time limit exceeded
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 642 ms 14216 KB Output is correct
3 Execution timed out 4029 ms 15388 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 788 ms 16844 KB Output is correct
3 Execution timed out 4046 ms 15808 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4948 KB Output is correct
2 Correct 3 ms 4948 KB Output is correct
3 Correct 4 ms 4948 KB Output is correct
4 Correct 5 ms 5032 KB Output is correct
5 Correct 7 ms 5076 KB Output is correct
6 Correct 11 ms 5092 KB Output is correct
7 Correct 9 ms 5096 KB Output is correct
8 Correct 7 ms 5076 KB Output is correct
9 Correct 3 ms 5028 KB Output is correct
10 Correct 3 ms 4948 KB Output is correct
11 Correct 3 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 4 ms 5032 KB Output is correct
14 Correct 4 ms 4936 KB Output is correct
15 Correct 4 ms 5028 KB Output is correct
16 Correct 4 ms 4948 KB Output is correct
17 Correct 3 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 4 ms 4948 KB Output is correct
20 Correct 3 ms 5024 KB Output is correct
21 Correct 3 ms 4976 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 3 ms 4980 KB Output is correct
24 Correct 3 ms 4948 KB Output is correct
25 Correct 3 ms 4948 KB Output is correct
26 Correct 3 ms 5004 KB Output is correct
27 Correct 3 ms 5032 KB Output is correct
28 Correct 3 ms 4948 KB Output is correct
29 Correct 3 ms 4948 KB Output is correct
30 Correct 220 ms 16848 KB Output is correct
31 Correct 299 ms 13620 KB Output is correct
32 Correct 244 ms 15252 KB Output is correct
33 Correct 262 ms 15380 KB Output is correct
34 Correct 238 ms 15500 KB Output is correct
35 Correct 270 ms 15572 KB Output is correct
36 Correct 199 ms 16280 KB Output is correct
37 Correct 285 ms 16664 KB Output is correct
38 Correct 306 ms 13688 KB Output is correct
39 Correct 244 ms 16888 KB Output is correct
40 Correct 325 ms 13984 KB Output is correct
41 Execution timed out 4057 ms 13944 KB Time limit exceeded
42 Halted 0 ms 0 KB -