#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
const int maxq = 4e5 + 10;
struct query
{
int type, ver, d, t;
ll w;
}ask[maxq];
const int maxn = 2e5 + 10;
int n, q;
ll l, h[maxn];
vector < query > task[maxn];
vector < int > adj[maxn];
bool cmp(query a1, query a2)
{
return a1.d < a2.d;
}
void input()
{
cin >> n >> l;
for (int i = 1; i < n; i ++)
{
int v, u;
cin >> v >> u;
adj[v].push_back(u);
adj[u].push_back(v);
}
for (int i = 1; i <= n; i ++)
cin >> h[i];
cin >> q;
for (int i = 1; i <= q; i ++)
{
cin >> ask[i].type;
if (ask[i].type == 1)
cin >> ask[i].ver >> ask[i].d >> ask[i].w;
else
cin >> ask[i].ver;
ask[i].t = i;
}
}
struct segment_tree
{
vector < ll > tree, lazy;
segment_tree(int len = 0)
{
tree.resize(4 * (len + 1));
lazy.resize(4 * (len + 1));
fill(tree.begin(), tree.end(), 1);
fill(lazy.begin(), lazy.end(), 1);
}
void push_lazy(int &root, int &left, int &right)
{
tree[root] *= lazy[root];
tree[root] %= l;
if (left != right)
{
lazy[root * 2] *= (lazy[root]);
lazy[root * 2 + 1] *= (lazy[root]);
lazy[root * 2] %= l;
lazy[root * 2 + 1] %= l;
}
lazy[root] = 1;
}
void update_range(int root, int left, int right, int qleft, int qright, ll val)
{
if (tree[root] == 0)
return;
if (lazy[root] != 1)
push_lazy(root, left, right);
if (left > qright || right < qleft)
return;
if (left >= qleft && right <= qright)
{
lazy[root] = val;
push_lazy(root, left, right);
return;
}
int mid = (left + right) / 2;
update_range(root * 2, left, mid, qleft, qright, val);
update_range(root * 2 + 1, mid + 1, right, qleft, qright, val);
}
ll get_point(int root, int left, int right, int pos)
{
if (lazy[root] != 1)
push_lazy(root, left, right);
if (left == right)
return tree[root];
int mid = (left + right) / 2;
if (pos <= mid)
return get_point(root * 2, left, mid, pos);
return get_point(root * 2 + 1, mid + 1, right, pos);
}
};
const int maxd = 40;
segment_tree st[maxn];
ll to_mult[maxn][maxd + 1];
int par[maxn], depth[maxn];
vector < int > by_depth[maxn];
int tin[maxn], tout[maxn], timer, rev[maxn];
void dfs(int v)
{
tin[v] = ++ timer;
///cout << "dfs " << v << " " << depth[v] << endl;
rev[v] = by_depth[depth[v]].size();
by_depth[depth[v]].push_back(v);
for (int u : adj[v])
{
if (u == par[v])
continue;
par[u] = v;
depth[u] = depth[v] + 1;
dfs(u);
}
tout[v] = timer;
}
void update_row(int row, int left, int right, ll val)
{
int lf = 0, rf = (int)(by_depth[row].size()) - 1;
while(lf <= rf)
{
int mf = (lf + rf) / 2;
if (tin[by_depth[row][mf]] < left)
lf = mf + 1;
else
rf = mf - 1;
}
int lb = lf;
lf = 0;
rf = (int)(by_depth[row].size()) - 1;
while(lf <= rf)
{
int mf = (lf + rf) / 2;
if (tin[by_depth[row][mf]] <= right)
lf = mf + 1;
else
rf = mf - 1;
}
int rb = rf;
st[row].update_range(1, 0, (int)(by_depth[row].size()) - 1, lb, rb, val);
}
void make_query(int v)
{
ll ans = h[v];
int u = v, cnt = 0;
while(u != 0 && cnt <= maxd)
{
///cout << "query " << v << " " << u << " " << cnt << " " << to_mult[u][cnt] << endl;
ans = ans * to_mult[u][cnt];
ans %= l;
u = par[u];
cnt ++;
}
cout << ans << endl;
}
void simulate()
{
for (int i = 1; i <= n; i ++)
{
//st[i] = segment_tree(by_depth[i].size());
for (int j = 0; j <= maxd; j ++)
to_mult[i][j] = 1;
}
for (int i = 1; i <= q; i ++)
{
if (ask[i].type == 2)
make_query(ask[i].ver);
else
{
int cnt = 0, ver = ask[i].ver;
while(ver != 1 && cnt <= ask[i].d)
{
int lf = ask[i].d - cnt;
to_mult[ver][lf] *= ask[i].w;
if (lf != 0)
to_mult[ver][lf - 1] *= ask[i].w;
to_mult[ver][lf] %= l;
if (lf != 0)
to_mult[ver][lf - 1] %= l;
///update_row(depth[ver] + lf, tin[ver], tout[ver], ask[i].w);
///cout << "update " << ver << " " << depth[ver] + lf << endl;
//if (lf != 0)
///update_row(depth[ver] + lf - 1, tin[ver], tout[ver], ask[i].w);
cnt ++;
ver = par[ver];
}
if (ver == 1 && cnt <= ask[i].d)
{
int lf = ask[i].d - cnt;
for (int j = 0; j <= lf; j ++)
{
///cout << "update " << ver << " " << depth[ver] + j << endl;
//update_row(depth[ver] + j, tin[ver], tout[ver], ask[i].w);
to_mult[ver][j] *= ask[i].w;
to_mult[ver][j] %= l;
}
}
}
}
}
void solve()
{
input();
///offline_queries();
depth[1] = 1;
dfs(1);
simulate();
}
int main()
{
speed();
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
50000 KB |
Output is correct |
2 |
Correct |
23 ms |
50008 KB |
Output is correct |
3 |
Correct |
24 ms |
50008 KB |
Output is correct |
4 |
Correct |
26 ms |
50096 KB |
Output is correct |
5 |
Correct |
24 ms |
50060 KB |
Output is correct |
6 |
Correct |
24 ms |
50008 KB |
Output is correct |
7 |
Correct |
24 ms |
49996 KB |
Output is correct |
8 |
Correct |
26 ms |
50004 KB |
Output is correct |
9 |
Correct |
24 ms |
50012 KB |
Output is correct |
10 |
Correct |
25 ms |
50012 KB |
Output is correct |
11 |
Correct |
24 ms |
50012 KB |
Output is correct |
12 |
Correct |
24 ms |
50012 KB |
Output is correct |
13 |
Correct |
24 ms |
50044 KB |
Output is correct |
14 |
Correct |
24 ms |
50012 KB |
Output is correct |
15 |
Correct |
28 ms |
49944 KB |
Output is correct |
16 |
Correct |
24 ms |
50008 KB |
Output is correct |
17 |
Correct |
25 ms |
50000 KB |
Output is correct |
18 |
Correct |
25 ms |
50012 KB |
Output is correct |
19 |
Correct |
25 ms |
50020 KB |
Output is correct |
20 |
Correct |
25 ms |
50012 KB |
Output is correct |
21 |
Correct |
24 ms |
50008 KB |
Output is correct |
22 |
Correct |
27 ms |
50268 KB |
Output is correct |
23 |
Correct |
24 ms |
49808 KB |
Output is correct |
24 |
Correct |
24 ms |
50008 KB |
Output is correct |
25 |
Correct |
24 ms |
50012 KB |
Output is correct |
26 |
Correct |
29 ms |
49848 KB |
Output is correct |
27 |
Correct |
24 ms |
50012 KB |
Output is correct |
28 |
Correct |
25 ms |
49812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
50012 KB |
Output is correct |
2 |
Correct |
387 ms |
132760 KB |
Output is correct |
3 |
Correct |
244 ms |
129620 KB |
Output is correct |
4 |
Correct |
377 ms |
142020 KB |
Output is correct |
5 |
Correct |
340 ms |
131268 KB |
Output is correct |
6 |
Correct |
270 ms |
131140 KB |
Output is correct |
7 |
Correct |
231 ms |
131252 KB |
Output is correct |
8 |
Correct |
205 ms |
131652 KB |
Output is correct |
9 |
Correct |
469 ms |
149840 KB |
Output is correct |
10 |
Correct |
294 ms |
144980 KB |
Output is correct |
11 |
Correct |
398 ms |
132772 KB |
Output is correct |
12 |
Correct |
246 ms |
129620 KB |
Output is correct |
13 |
Correct |
196 ms |
130760 KB |
Output is correct |
14 |
Correct |
219 ms |
129968 KB |
Output is correct |
15 |
Correct |
203 ms |
129940 KB |
Output is correct |
16 |
Correct |
212 ms |
129856 KB |
Output is correct |
17 |
Correct |
218 ms |
130536 KB |
Output is correct |
18 |
Correct |
24 ms |
50264 KB |
Output is correct |
19 |
Correct |
28 ms |
49892 KB |
Output is correct |
20 |
Correct |
24 ms |
50012 KB |
Output is correct |
21 |
Correct |
25 ms |
50048 KB |
Output is correct |
22 |
Correct |
24 ms |
50040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
50012 KB |
Output is correct |
2 |
Correct |
387 ms |
132760 KB |
Output is correct |
3 |
Correct |
244 ms |
129620 KB |
Output is correct |
4 |
Correct |
377 ms |
142020 KB |
Output is correct |
5 |
Correct |
340 ms |
131268 KB |
Output is correct |
6 |
Correct |
270 ms |
131140 KB |
Output is correct |
7 |
Correct |
231 ms |
131252 KB |
Output is correct |
8 |
Correct |
205 ms |
131652 KB |
Output is correct |
9 |
Correct |
469 ms |
149840 KB |
Output is correct |
10 |
Correct |
294 ms |
144980 KB |
Output is correct |
11 |
Correct |
398 ms |
132772 KB |
Output is correct |
12 |
Correct |
246 ms |
129620 KB |
Output is correct |
13 |
Correct |
196 ms |
130760 KB |
Output is correct |
14 |
Correct |
219 ms |
129968 KB |
Output is correct |
15 |
Correct |
203 ms |
129940 KB |
Output is correct |
16 |
Correct |
212 ms |
129856 KB |
Output is correct |
17 |
Correct |
218 ms |
130536 KB |
Output is correct |
18 |
Correct |
24 ms |
50264 KB |
Output is correct |
19 |
Correct |
28 ms |
49892 KB |
Output is correct |
20 |
Correct |
24 ms |
50012 KB |
Output is correct |
21 |
Correct |
25 ms |
50048 KB |
Output is correct |
22 |
Correct |
24 ms |
50040 KB |
Output is correct |
23 |
Correct |
24 ms |
50016 KB |
Output is correct |
24 |
Correct |
370 ms |
132880 KB |
Output is correct |
25 |
Correct |
264 ms |
129620 KB |
Output is correct |
26 |
Correct |
380 ms |
147232 KB |
Output is correct |
27 |
Correct |
304 ms |
131152 KB |
Output is correct |
28 |
Correct |
261 ms |
131244 KB |
Output is correct |
29 |
Correct |
237 ms |
131168 KB |
Output is correct |
30 |
Correct |
216 ms |
131532 KB |
Output is correct |
31 |
Correct |
478 ms |
144108 KB |
Output is correct |
32 |
Correct |
318 ms |
145252 KB |
Output is correct |
33 |
Correct |
355 ms |
132688 KB |
Output is correct |
34 |
Correct |
262 ms |
130132 KB |
Output is correct |
35 |
Correct |
24 ms |
50012 KB |
Output is correct |
36 |
Correct |
25 ms |
50012 KB |
Output is correct |
37 |
Correct |
24 ms |
50012 KB |
Output is correct |
38 |
Correct |
24 ms |
50008 KB |
Output is correct |
39 |
Correct |
25 ms |
50012 KB |
Output is correct |
40 |
Correct |
25 ms |
50024 KB |
Output is correct |
41 |
Correct |
25 ms |
50168 KB |
Output is correct |
42 |
Correct |
24 ms |
50012 KB |
Output is correct |
43 |
Correct |
23 ms |
50012 KB |
Output is correct |
44 |
Correct |
24 ms |
50012 KB |
Output is correct |
45 |
Correct |
24 ms |
50008 KB |
Output is correct |
46 |
Correct |
24 ms |
50008 KB |
Output is correct |
47 |
Correct |
25 ms |
50012 KB |
Output is correct |
48 |
Correct |
31 ms |
50012 KB |
Output is correct |
49 |
Correct |
24 ms |
50012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
50008 KB |
Output is correct |
2 |
Correct |
502 ms |
146596 KB |
Output is correct |
3 |
Correct |
610 ms |
141676 KB |
Output is correct |
4 |
Correct |
450 ms |
142932 KB |
Output is correct |
5 |
Correct |
382 ms |
129712 KB |
Output is correct |
6 |
Correct |
274 ms |
129744 KB |
Output is correct |
7 |
Correct |
267 ms |
129868 KB |
Output is correct |
8 |
Correct |
226 ms |
130016 KB |
Output is correct |
9 |
Correct |
494 ms |
141652 KB |
Output is correct |
10 |
Correct |
618 ms |
144724 KB |
Output is correct |
11 |
Correct |
401 ms |
130028 KB |
Output is correct |
12 |
Correct |
403 ms |
129444 KB |
Output is correct |
13 |
Correct |
332 ms |
139584 KB |
Output is correct |
14 |
Correct |
342 ms |
140760 KB |
Output is correct |
15 |
Correct |
26 ms |
50012 KB |
Output is correct |
16 |
Correct |
26 ms |
50256 KB |
Output is correct |
17 |
Correct |
24 ms |
50012 KB |
Output is correct |
18 |
Correct |
24 ms |
50016 KB |
Output is correct |
19 |
Correct |
26 ms |
50012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
50012 KB |
Output is correct |
2 |
Correct |
517 ms |
143504 KB |
Output is correct |
3 |
Correct |
623 ms |
137800 KB |
Output is correct |
4 |
Correct |
481 ms |
141032 KB |
Output is correct |
5 |
Correct |
361 ms |
131156 KB |
Output is correct |
6 |
Correct |
299 ms |
131672 KB |
Output is correct |
7 |
Correct |
277 ms |
131156 KB |
Output is correct |
8 |
Correct |
214 ms |
131304 KB |
Output is correct |
9 |
Correct |
520 ms |
148436 KB |
Output is correct |
10 |
Correct |
619 ms |
145608 KB |
Output is correct |
11 |
Correct |
380 ms |
132792 KB |
Output is correct |
12 |
Correct |
422 ms |
129620 KB |
Output is correct |
13 |
Correct |
333 ms |
139812 KB |
Output is correct |
14 |
Correct |
334 ms |
140624 KB |
Output is correct |
15 |
Correct |
24 ms |
50012 KB |
Output is correct |
16 |
Correct |
24 ms |
50012 KB |
Output is correct |
17 |
Correct |
24 ms |
50004 KB |
Output is correct |
18 |
Correct |
28 ms |
49916 KB |
Output is correct |
19 |
Correct |
26 ms |
50012 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
50000 KB |
Output is correct |
2 |
Correct |
23 ms |
50008 KB |
Output is correct |
3 |
Correct |
24 ms |
50008 KB |
Output is correct |
4 |
Correct |
26 ms |
50096 KB |
Output is correct |
5 |
Correct |
24 ms |
50060 KB |
Output is correct |
6 |
Correct |
24 ms |
50008 KB |
Output is correct |
7 |
Correct |
24 ms |
49996 KB |
Output is correct |
8 |
Correct |
26 ms |
50004 KB |
Output is correct |
9 |
Correct |
24 ms |
50012 KB |
Output is correct |
10 |
Correct |
25 ms |
50012 KB |
Output is correct |
11 |
Correct |
24 ms |
50012 KB |
Output is correct |
12 |
Correct |
24 ms |
50012 KB |
Output is correct |
13 |
Correct |
24 ms |
50044 KB |
Output is correct |
14 |
Correct |
24 ms |
50012 KB |
Output is correct |
15 |
Correct |
28 ms |
49944 KB |
Output is correct |
16 |
Correct |
24 ms |
50008 KB |
Output is correct |
17 |
Correct |
25 ms |
50000 KB |
Output is correct |
18 |
Correct |
25 ms |
50012 KB |
Output is correct |
19 |
Correct |
25 ms |
50020 KB |
Output is correct |
20 |
Correct |
25 ms |
50012 KB |
Output is correct |
21 |
Correct |
24 ms |
50008 KB |
Output is correct |
22 |
Correct |
27 ms |
50268 KB |
Output is correct |
23 |
Correct |
24 ms |
49808 KB |
Output is correct |
24 |
Correct |
24 ms |
50008 KB |
Output is correct |
25 |
Correct |
24 ms |
50012 KB |
Output is correct |
26 |
Correct |
29 ms |
49848 KB |
Output is correct |
27 |
Correct |
24 ms |
50012 KB |
Output is correct |
28 |
Correct |
25 ms |
49812 KB |
Output is correct |
29 |
Correct |
24 ms |
50012 KB |
Output is correct |
30 |
Correct |
387 ms |
132760 KB |
Output is correct |
31 |
Correct |
244 ms |
129620 KB |
Output is correct |
32 |
Correct |
377 ms |
142020 KB |
Output is correct |
33 |
Correct |
340 ms |
131268 KB |
Output is correct |
34 |
Correct |
270 ms |
131140 KB |
Output is correct |
35 |
Correct |
231 ms |
131252 KB |
Output is correct |
36 |
Correct |
205 ms |
131652 KB |
Output is correct |
37 |
Correct |
469 ms |
149840 KB |
Output is correct |
38 |
Correct |
294 ms |
144980 KB |
Output is correct |
39 |
Correct |
398 ms |
132772 KB |
Output is correct |
40 |
Correct |
246 ms |
129620 KB |
Output is correct |
41 |
Correct |
196 ms |
130760 KB |
Output is correct |
42 |
Correct |
219 ms |
129968 KB |
Output is correct |
43 |
Correct |
203 ms |
129940 KB |
Output is correct |
44 |
Correct |
212 ms |
129856 KB |
Output is correct |
45 |
Correct |
218 ms |
130536 KB |
Output is correct |
46 |
Correct |
24 ms |
50264 KB |
Output is correct |
47 |
Correct |
28 ms |
49892 KB |
Output is correct |
48 |
Correct |
24 ms |
50012 KB |
Output is correct |
49 |
Correct |
25 ms |
50048 KB |
Output is correct |
50 |
Correct |
24 ms |
50040 KB |
Output is correct |
51 |
Correct |
24 ms |
50016 KB |
Output is correct |
52 |
Correct |
370 ms |
132880 KB |
Output is correct |
53 |
Correct |
264 ms |
129620 KB |
Output is correct |
54 |
Correct |
380 ms |
147232 KB |
Output is correct |
55 |
Correct |
304 ms |
131152 KB |
Output is correct |
56 |
Correct |
261 ms |
131244 KB |
Output is correct |
57 |
Correct |
237 ms |
131168 KB |
Output is correct |
58 |
Correct |
216 ms |
131532 KB |
Output is correct |
59 |
Correct |
478 ms |
144108 KB |
Output is correct |
60 |
Correct |
318 ms |
145252 KB |
Output is correct |
61 |
Correct |
355 ms |
132688 KB |
Output is correct |
62 |
Correct |
262 ms |
130132 KB |
Output is correct |
63 |
Correct |
24 ms |
50012 KB |
Output is correct |
64 |
Correct |
25 ms |
50012 KB |
Output is correct |
65 |
Correct |
24 ms |
50012 KB |
Output is correct |
66 |
Correct |
24 ms |
50008 KB |
Output is correct |
67 |
Correct |
25 ms |
50012 KB |
Output is correct |
68 |
Correct |
25 ms |
50024 KB |
Output is correct |
69 |
Correct |
25 ms |
50168 KB |
Output is correct |
70 |
Correct |
24 ms |
50012 KB |
Output is correct |
71 |
Correct |
23 ms |
50012 KB |
Output is correct |
72 |
Correct |
24 ms |
50012 KB |
Output is correct |
73 |
Correct |
24 ms |
50008 KB |
Output is correct |
74 |
Correct |
24 ms |
50008 KB |
Output is correct |
75 |
Correct |
25 ms |
50012 KB |
Output is correct |
76 |
Correct |
31 ms |
50012 KB |
Output is correct |
77 |
Correct |
24 ms |
50012 KB |
Output is correct |
78 |
Correct |
25 ms |
50008 KB |
Output is correct |
79 |
Correct |
502 ms |
146596 KB |
Output is correct |
80 |
Correct |
610 ms |
141676 KB |
Output is correct |
81 |
Correct |
450 ms |
142932 KB |
Output is correct |
82 |
Correct |
382 ms |
129712 KB |
Output is correct |
83 |
Correct |
274 ms |
129744 KB |
Output is correct |
84 |
Correct |
267 ms |
129868 KB |
Output is correct |
85 |
Correct |
226 ms |
130016 KB |
Output is correct |
86 |
Correct |
494 ms |
141652 KB |
Output is correct |
87 |
Correct |
618 ms |
144724 KB |
Output is correct |
88 |
Correct |
401 ms |
130028 KB |
Output is correct |
89 |
Correct |
403 ms |
129444 KB |
Output is correct |
90 |
Correct |
332 ms |
139584 KB |
Output is correct |
91 |
Correct |
342 ms |
140760 KB |
Output is correct |
92 |
Correct |
26 ms |
50012 KB |
Output is correct |
93 |
Correct |
26 ms |
50256 KB |
Output is correct |
94 |
Correct |
24 ms |
50012 KB |
Output is correct |
95 |
Correct |
24 ms |
50016 KB |
Output is correct |
96 |
Correct |
26 ms |
50012 KB |
Output is correct |
97 |
Correct |
26 ms |
50012 KB |
Output is correct |
98 |
Correct |
517 ms |
143504 KB |
Output is correct |
99 |
Correct |
623 ms |
137800 KB |
Output is correct |
100 |
Correct |
481 ms |
141032 KB |
Output is correct |
101 |
Correct |
361 ms |
131156 KB |
Output is correct |
102 |
Correct |
299 ms |
131672 KB |
Output is correct |
103 |
Correct |
277 ms |
131156 KB |
Output is correct |
104 |
Correct |
214 ms |
131304 KB |
Output is correct |
105 |
Correct |
520 ms |
148436 KB |
Output is correct |
106 |
Correct |
619 ms |
145608 KB |
Output is correct |
107 |
Correct |
380 ms |
132792 KB |
Output is correct |
108 |
Correct |
422 ms |
129620 KB |
Output is correct |
109 |
Correct |
333 ms |
139812 KB |
Output is correct |
110 |
Correct |
334 ms |
140624 KB |
Output is correct |
111 |
Correct |
24 ms |
50012 KB |
Output is correct |
112 |
Correct |
24 ms |
50012 KB |
Output is correct |
113 |
Correct |
24 ms |
50004 KB |
Output is correct |
114 |
Correct |
28 ms |
49916 KB |
Output is correct |
115 |
Correct |
26 ms |
50012 KB |
Output is correct |
116 |
Correct |
381 ms |
139048 KB |
Output is correct |
117 |
Correct |
444 ms |
141836 KB |
Output is correct |
118 |
Correct |
490 ms |
157168 KB |
Output is correct |
119 |
Correct |
384 ms |
141420 KB |
Output is correct |
120 |
Correct |
312 ms |
141104 KB |
Output is correct |
121 |
Correct |
306 ms |
141536 KB |
Output is correct |
122 |
Correct |
252 ms |
141908 KB |
Output is correct |
123 |
Correct |
511 ms |
154076 KB |
Output is correct |
124 |
Correct |
620 ms |
151120 KB |
Output is correct |
125 |
Correct |
418 ms |
140244 KB |
Output is correct |
126 |
Correct |
489 ms |
141656 KB |
Output is correct |
127 |
Correct |
493 ms |
142164 KB |
Output is correct |
128 |
Correct |
446 ms |
142876 KB |
Output is correct |
129 |
Correct |
455 ms |
143788 KB |
Output is correct |