Submission #676377

# Submission time Handle Problem Language Result Execution time Memory
676377 2022-12-30T14:16:11 Z penguin133 Rainforest Jumps (APIO21_jumps) C++17
100 / 100
1606 ms 86472 KB
#include "jumps.h"
#include <bits/stdc++.h>
using namespace std;
 
int n, flag;
int X[200005], Y[200005], h[200005];
int par[20][200005], par2[20][200005], par3[20][200005], par4[20][200005];
 
struct node{
	int s,e,m, val;
	node *l, *r;
	node(int _s, int _e){
		s = _s, e = _e, m = (s + e)>>1;
		if(s != e){
			l = new node(s, m);
			r = new node(m+1, e);
			val = max(l->val, r->val);
		}
		else val = h[s];
	}
	
	int query(int a, int b){
		if(s == a && b == e)return val;
		else if(b <= m)return l->query(a, b);
		else if(a > m)return r->query(a, b);
		else return max(l->query(a, m), r->query(m+1, b));
	}
	
}*root;
 
 
void init(int N, vector<int> H){
	n = N;
	stack<int>s;
	for(int i=0;i<n;i++){
		h[i] = H[i];
		while(!s.empty() && H[s.top()] < H[i])s.pop();
		X[i] = (s.empty() ? -1 : s.top());
		par3[0][i] = X[i];
		s.push(i);
	}
	flag = 1;
	for(int i=0;i<n;i++)if(H[i] != i + 1)flag= 0;
	while(!s.empty())s.pop();
	for(int i=n-1;i>=0;i--){
		while(!s.empty() && H[s.top()] < H[i])s.pop();
		Y[i] = (s.empty() ? -1 : s.top());
		par4[0][i] = Y[i];
		s.push(i);
	}
	root = new node(0, n-1);
	for(int i=0;i<n;i++){
		if(X[i] == -1 && Y[i] == -1)par[0][i] = par2[0][i] = -1;
		else if(X[i] == -1)par[0][i] = Y[i], par2[0][i] = -1;
		else if(Y[i] == -1)par[0][i] = X[i], par2[0][i] = -1;
		else par[0][i] = (H[X[i]] > H[Y[i]] ? X[i] : Y[i]), par2[0][i] = (par[0][i] == X[i] ? Y[i] : X[i]);
	}
	for(int i=1;i<=19;i++)for(int j=0;j<n;j++)par[i][j] = (par[i-1][j] == -1 ? -1 : par[i-1][par[i-1][j]]);
	for(int i=1;i<=19;i++)for(int j=0;j<n;j++)par2[i][j] = (par2[i-1][j] == -1 ? -1 : par2[i-1][par2[i-1][j]]);
	for(int i=1;i<=19;i++)for(int j=0;j<n;j++)par3[i][j] = (par3[i-1][j] == -1 ? -1 : par3[i-1][par3[i-1][j]]);
	for(int i=1;i<=19;i++)for(int j=0;j<n;j++)par4[i][j] = (par4[i-1][j] == -1 ? -1 : par4[i-1][par4[i-1][j]]);
}
 
int minimum_jumps(int a, int b, int c, int d){
 
	int ans = 0, tmp = b;
	int mx = root->query(c, d);
	int mx2 = root->query(b, c-1);
	if(mx2 > mx)return -1;
	for(int i=19;i>=0;i--)if(par3[i][tmp] != -1 && par3[i][tmp] >= a && h[par3[i][tmp]] <= mx)tmp = par3[i][tmp];
	if(par4[0][tmp] >= c)return 1;
	for(int i=19;i>=0;i--)if(par[i][tmp] != -1 && (par4[0][par[i][tmp]] != -1 && par4[0][par[i][tmp]] < c) && h[par[i][tmp]] <= mx)tmp = par[i][tmp], ans += (1 << i);
	if (h[par[0][tmp]]<mx && par[0][tmp]!=-1) return ans+2;
	for(int i=19;i>=0;i--)if(par4[i][tmp] != -1 && par4[i][tmp] < c && h[par4[i][tmp]] <= mx)tmp = par4[i][tmp], ans += (1 << i);
//	cerr << tmp << '\n';
	assert(par4[0][tmp] >= c && par4[0][tmp] <= d);
	return ans + 1;
	
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 193 ms 69156 KB Output is correct
4 Correct 1137 ms 86324 KB Output is correct
5 Correct 1156 ms 43952 KB Output is correct
6 Correct 1473 ms 86392 KB Output is correct
7 Correct 1014 ms 59488 KB Output is correct
8 Correct 1259 ms 86456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 772 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 1 ms 720 KB Output is correct
4 Correct 1 ms 720 KB Output is correct
5 Correct 2 ms 720 KB Output is correct
6 Correct 2 ms 848 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 3 ms 720 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 3 ms 720 KB Output is correct
11 Correct 3 ms 720 KB Output is correct
12 Correct 3 ms 720 KB Output is correct
13 Correct 3 ms 720 KB Output is correct
14 Correct 3 ms 720 KB Output is correct
15 Correct 4 ms 848 KB Output is correct
16 Correct 2 ms 832 KB Output is correct
17 Correct 2 ms 720 KB Output is correct
18 Correct 1 ms 720 KB Output is correct
19 Correct 1 ms 720 KB Output is correct
20 Correct 4 ms 848 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 740 KB Output is correct
23 Correct 3 ms 848 KB Output is correct
24 Correct 3 ms 848 KB Output is correct
25 Correct 0 ms 720 KB Output is correct
26 Correct 1 ms 720 KB Output is correct
27 Correct 2 ms 720 KB Output is correct
28 Correct 2 ms 720 KB Output is correct
29 Correct 3 ms 848 KB Output is correct
30 Correct 2 ms 720 KB Output is correct
31 Correct 2 ms 848 KB Output is correct
32 Correct 3 ms 720 KB Output is correct
33 Correct 1 ms 768 KB Output is correct
34 Correct 1 ms 720 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 1 ms 720 KB Output is correct
37 Correct 1 ms 896 KB Output is correct
38 Correct 1 ms 716 KB Output is correct
39 Correct 1 ms 896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 772 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 1 ms 720 KB Output is correct
4 Correct 1 ms 720 KB Output is correct
5 Correct 2 ms 720 KB Output is correct
6 Correct 2 ms 848 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 3 ms 720 KB Output is correct
9 Correct 1 ms 720 KB Output is correct
10 Correct 3 ms 720 KB Output is correct
11 Correct 3 ms 720 KB Output is correct
12 Correct 3 ms 720 KB Output is correct
13 Correct 3 ms 720 KB Output is correct
14 Correct 3 ms 720 KB Output is correct
15 Correct 4 ms 848 KB Output is correct
16 Correct 2 ms 832 KB Output is correct
17 Correct 2 ms 720 KB Output is correct
18 Correct 1 ms 720 KB Output is correct
19 Correct 1 ms 720 KB Output is correct
20 Correct 4 ms 848 KB Output is correct
21 Correct 2 ms 720 KB Output is correct
22 Correct 2 ms 740 KB Output is correct
23 Correct 3 ms 848 KB Output is correct
24 Correct 3 ms 848 KB Output is correct
25 Correct 0 ms 720 KB Output is correct
26 Correct 1 ms 720 KB Output is correct
27 Correct 2 ms 720 KB Output is correct
28 Correct 2 ms 720 KB Output is correct
29 Correct 3 ms 848 KB Output is correct
30 Correct 2 ms 720 KB Output is correct
31 Correct 2 ms 848 KB Output is correct
32 Correct 3 ms 720 KB Output is correct
33 Correct 1 ms 768 KB Output is correct
34 Correct 1 ms 720 KB Output is correct
35 Correct 1 ms 720 KB Output is correct
36 Correct 1 ms 720 KB Output is correct
37 Correct 1 ms 896 KB Output is correct
38 Correct 1 ms 716 KB Output is correct
39 Correct 1 ms 896 KB Output is correct
40 Correct 1 ms 720 KB Output is correct
41 Correct 1 ms 720 KB Output is correct
42 Correct 1 ms 720 KB Output is correct
43 Correct 1 ms 720 KB Output is correct
44 Correct 3 ms 720 KB Output is correct
45 Correct 3 ms 720 KB Output is correct
46 Correct 2 ms 720 KB Output is correct
47 Correct 2 ms 720 KB Output is correct
48 Correct 1 ms 720 KB Output is correct
49 Correct 2 ms 720 KB Output is correct
50 Correct 3 ms 720 KB Output is correct
51 Correct 3 ms 848 KB Output is correct
52 Correct 3 ms 720 KB Output is correct
53 Correct 3 ms 720 KB Output is correct
54 Correct 4 ms 720 KB Output is correct
55 Correct 5 ms 720 KB Output is correct
56 Correct 2 ms 848 KB Output is correct
57 Correct 1 ms 720 KB Output is correct
58 Correct 23 ms 1360 KB Output is correct
59 Correct 25 ms 1604 KB Output is correct
60 Correct 7 ms 1104 KB Output is correct
61 Correct 23 ms 1488 KB Output is correct
62 Correct 14 ms 720 KB Output is correct
63 Correct 20 ms 1488 KB Output is correct
64 Correct 22 ms 1488 KB Output is correct
65 Correct 21 ms 1616 KB Output is correct
66 Correct 20 ms 1616 KB Output is correct
67 Correct 14 ms 1488 KB Output is correct
68 Correct 23 ms 1488 KB Output is correct
69 Correct 18 ms 1488 KB Output is correct
70 Correct 21 ms 1616 KB Output is correct
71 Correct 1 ms 720 KB Output is correct
72 Correct 1 ms 720 KB Output is correct
73 Correct 3 ms 720 KB Output is correct
74 Correct 3 ms 720 KB Output is correct
75 Correct 2 ms 848 KB Output is correct
76 Correct 3 ms 720 KB Output is correct
77 Correct 3 ms 720 KB Output is correct
78 Correct 1 ms 720 KB Output is correct
79 Correct 1 ms 720 KB Output is correct
80 Correct 2 ms 720 KB Output is correct
81 Correct 3 ms 720 KB Output is correct
82 Correct 2 ms 720 KB Output is correct
83 Correct 2 ms 848 KB Output is correct
84 Correct 2 ms 720 KB Output is correct
85 Correct 3 ms 720 KB Output is correct
86 Correct 1 ms 720 KB Output is correct
87 Correct 1 ms 720 KB Output is correct
88 Correct 1 ms 896 KB Output is correct
89 Correct 1 ms 720 KB Output is correct
90 Correct 1 ms 720 KB Output is correct
91 Correct 1 ms 896 KB Output is correct
92 Correct 1 ms 720 KB Output is correct
93 Correct 1 ms 720 KB Output is correct
94 Correct 4 ms 848 KB Output is correct
95 Correct 28 ms 1488 KB Output is correct
96 Correct 26 ms 1488 KB Output is correct
97 Correct 22 ms 1488 KB Output is correct
98 Correct 19 ms 1488 KB Output is correct
99 Correct 23 ms 1616 KB Output is correct
100 Correct 1 ms 896 KB Output is correct
101 Correct 1 ms 976 KB Output is correct
102 Correct 20 ms 1488 KB Output is correct
103 Correct 26 ms 1616 KB Output is correct
104 Correct 16 ms 1488 KB Output is correct
105 Correct 21 ms 1488 KB Output is correct
106 Correct 21 ms 1616 KB Output is correct
107 Correct 1 ms 720 KB Output is correct
108 Correct 1 ms 1104 KB Output is correct
109 Correct 2 ms 1488 KB Output is correct
110 Correct 1 ms 1616 KB Output is correct
111 Correct 1 ms 1536 KB Output is correct
112 Correct 2 ms 1488 KB Output is correct
113 Correct 2 ms 1488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Output is correct
2 Correct 0 ms 720 KB Output is correct
3 Correct 1 ms 720 KB Output is correct
4 Correct 1 ms 720 KB Output is correct
5 Correct 93 ms 69212 KB Output is correct
6 Correct 80 ms 85500 KB Output is correct
7 Correct 50 ms 44472 KB Output is correct
8 Correct 78 ms 85544 KB Output is correct
9 Correct 13 ms 13540 KB Output is correct
10 Correct 87 ms 85612 KB Output is correct
11 Correct 74 ms 86368 KB Output is correct
12 Correct 76 ms 85944 KB Output is correct
13 Correct 100 ms 86100 KB Output is correct
14 Correct 79 ms 85568 KB Output is correct
15 Correct 73 ms 85524 KB Output is correct
16 Correct 90 ms 85672 KB Output is correct
17 Correct 76 ms 85532 KB Output is correct
18 Correct 1 ms 720 KB Output is correct
19 Correct 1 ms 768 KB Output is correct
20 Correct 1 ms 720 KB Output is correct
21 Correct 1 ms 848 KB Output is correct
22 Correct 1 ms 720 KB Output is correct
23 Correct 1 ms 720 KB Output is correct
24 Correct 1 ms 720 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 1 ms 1104 KB Output is correct
27 Correct 2 ms 1488 KB Output is correct
28 Correct 2 ms 1488 KB Output is correct
29 Correct 2 ms 1592 KB Output is correct
30 Correct 1 ms 1488 KB Output is correct
31 Correct 1 ms 1616 KB Output is correct
32 Correct 1 ms 720 KB Output is correct
33 Correct 85 ms 85448 KB Output is correct
34 Correct 87 ms 85540 KB Output is correct
35 Correct 97 ms 86176 KB Output is correct
36 Correct 94 ms 85648 KB Output is correct
37 Correct 94 ms 85508 KB Output is correct
38 Correct 76 ms 85604 KB Output is correct
39 Correct 1 ms 720 KB Output is correct
40 Correct 49 ms 50028 KB Output is correct
41 Correct 84 ms 85520 KB Output is correct
42 Correct 71 ms 86200 KB Output is correct
43 Correct 82 ms 85544 KB Output is correct
44 Correct 72 ms 85524 KB Output is correct
45 Correct 70 ms 85552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 1 ms 720 KB Output is correct
4 Correct 228 ms 39708 KB Output is correct
5 Correct 947 ms 85504 KB Output is correct
6 Correct 585 ms 14772 KB Output is correct
7 Correct 877 ms 85588 KB Output is correct
8 Correct 668 ms 30020 KB Output is correct
9 Correct 990 ms 85548 KB Output is correct
10 Correct 1331 ms 86336 KB Output is correct
11 Correct 1244 ms 85696 KB Output is correct
12 Correct 1213 ms 86356 KB Output is correct
13 Correct 727 ms 85540 KB Output is correct
14 Correct 1266 ms 85616 KB Output is correct
15 Correct 1096 ms 85596 KB Output is correct
16 Correct 1016 ms 85620 KB Output is correct
17 Correct 1 ms 720 KB Output is correct
18 Correct 1 ms 768 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 4 ms 896 KB Output is correct
21 Correct 3 ms 848 KB Output is correct
22 Correct 3 ms 720 KB Output is correct
23 Correct 4 ms 848 KB Output is correct
24 Correct 3 ms 720 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 1 ms 976 KB Output is correct
27 Correct 22 ms 1488 KB Output is correct
28 Correct 21 ms 1616 KB Output is correct
29 Correct 18 ms 1488 KB Output is correct
30 Correct 14 ms 1616 KB Output is correct
31 Correct 18 ms 1664 KB Output is correct
32 Correct 1 ms 748 KB Output is correct
33 Correct 52 ms 49968 KB Output is correct
34 Correct 86 ms 85560 KB Output is correct
35 Correct 75 ms 86200 KB Output is correct
36 Correct 83 ms 85536 KB Output is correct
37 Correct 78 ms 85620 KB Output is correct
38 Correct 87 ms 85652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 1 ms 720 KB Output is correct
4 Correct 228 ms 39708 KB Output is correct
5 Correct 947 ms 85504 KB Output is correct
6 Correct 585 ms 14772 KB Output is correct
7 Correct 877 ms 85588 KB Output is correct
8 Correct 668 ms 30020 KB Output is correct
9 Correct 990 ms 85548 KB Output is correct
10 Correct 1331 ms 86336 KB Output is correct
11 Correct 1244 ms 85696 KB Output is correct
12 Correct 1213 ms 86356 KB Output is correct
13 Correct 727 ms 85540 KB Output is correct
14 Correct 1266 ms 85616 KB Output is correct
15 Correct 1096 ms 85596 KB Output is correct
16 Correct 1016 ms 85620 KB Output is correct
17 Correct 1 ms 720 KB Output is correct
18 Correct 1 ms 768 KB Output is correct
19 Correct 2 ms 720 KB Output is correct
20 Correct 4 ms 896 KB Output is correct
21 Correct 3 ms 848 KB Output is correct
22 Correct 3 ms 720 KB Output is correct
23 Correct 4 ms 848 KB Output is correct
24 Correct 3 ms 720 KB Output is correct
25 Correct 1 ms 720 KB Output is correct
26 Correct 1 ms 976 KB Output is correct
27 Correct 22 ms 1488 KB Output is correct
28 Correct 21 ms 1616 KB Output is correct
29 Correct 18 ms 1488 KB Output is correct
30 Correct 14 ms 1616 KB Output is correct
31 Correct 18 ms 1664 KB Output is correct
32 Correct 1 ms 748 KB Output is correct
33 Correct 52 ms 49968 KB Output is correct
34 Correct 86 ms 85560 KB Output is correct
35 Correct 75 ms 86200 KB Output is correct
36 Correct 83 ms 85536 KB Output is correct
37 Correct 78 ms 85620 KB Output is correct
38 Correct 87 ms 85652 KB Output is correct
39 Correct 1 ms 720 KB Output is correct
40 Correct 1 ms 720 KB Output is correct
41 Correct 1 ms 720 KB Output is correct
42 Correct 213 ms 39620 KB Output is correct
43 Correct 1142 ms 85660 KB Output is correct
44 Correct 522 ms 14796 KB Output is correct
45 Correct 1180 ms 85584 KB Output is correct
46 Correct 713 ms 30032 KB Output is correct
47 Correct 966 ms 85540 KB Output is correct
48 Correct 1453 ms 86332 KB Output is correct
49 Correct 1407 ms 85688 KB Output is correct
50 Correct 1298 ms 86224 KB Output is correct
51 Correct 982 ms 85540 KB Output is correct
52 Correct 1227 ms 85644 KB Output is correct
53 Correct 995 ms 85560 KB Output is correct
54 Correct 788 ms 85576 KB Output is correct
55 Correct 1 ms 720 KB Output is correct
56 Correct 148 ms 85416 KB Output is correct
57 Correct 960 ms 85600 KB Output is correct
58 Correct 416 ms 15624 KB Output is correct
59 Correct 914 ms 85576 KB Output is correct
60 Correct 339 ms 30956 KB Output is correct
61 Correct 922 ms 85608 KB Output is correct
62 Correct 1342 ms 86428 KB Output is correct
63 Correct 1018 ms 85908 KB Output is correct
64 Correct 1285 ms 86016 KB Output is correct
65 Correct 1268 ms 85540 KB Output is correct
66 Correct 1606 ms 85548 KB Output is correct
67 Correct 1277 ms 85516 KB Output is correct
68 Correct 988 ms 85528 KB Output is correct
69 Correct 1 ms 720 KB Output is correct
70 Correct 1 ms 720 KB Output is correct
71 Correct 3 ms 720 KB Output is correct
72 Correct 2 ms 720 KB Output is correct
73 Correct 2 ms 720 KB Output is correct
74 Correct 2 ms 720 KB Output is correct
75 Correct 2 ms 720 KB Output is correct
76 Correct 1 ms 720 KB Output is correct
77 Correct 0 ms 720 KB Output is correct
78 Correct 2 ms 720 KB Output is correct
79 Correct 3 ms 720 KB Output is correct
80 Correct 3 ms 720 KB Output is correct
81 Correct 3 ms 720 KB Output is correct
82 Correct 3 ms 720 KB Output is correct
83 Correct 2 ms 720 KB Output is correct
84 Correct 1 ms 720 KB Output is correct
85 Correct 4 ms 848 KB Output is correct
86 Correct 17 ms 1488 KB Output is correct
87 Correct 18 ms 1488 KB Output is correct
88 Correct 22 ms 1488 KB Output is correct
89 Correct 11 ms 1488 KB Output is correct
90 Correct 16 ms 1488 KB Output is correct
91 Correct 1 ms 720 KB Output is correct
92 Correct 1 ms 976 KB Output is correct
93 Correct 21 ms 1488 KB Output is correct
94 Correct 21 ms 1488 KB Output is correct
95 Correct 14 ms 1488 KB Output is correct
96 Correct 19 ms 1616 KB Output is correct
97 Correct 15 ms 1616 KB Output is correct
98 Correct 0 ms 720 KB Output is correct
99 Correct 81 ms 85564 KB Output is correct
100 Correct 84 ms 85548 KB Output is correct
101 Correct 71 ms 86204 KB Output is correct
102 Correct 75 ms 85576 KB Output is correct
103 Correct 81 ms 85604 KB Output is correct
104 Correct 69 ms 85572 KB Output is correct
105 Correct 1 ms 720 KB Output is correct
106 Correct 53 ms 49960 KB Output is correct
107 Correct 79 ms 85560 KB Output is correct
108 Correct 72 ms 86220 KB Output is correct
109 Correct 77 ms 85508 KB Output is correct
110 Correct 87 ms 85512 KB Output is correct
111 Correct 82 ms 85540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 720 KB Output is correct
2 Correct 1 ms 720 KB Output is correct
3 Correct 193 ms 69156 KB Output is correct
4 Correct 1137 ms 86324 KB Output is correct
5 Correct 1156 ms 43952 KB Output is correct
6 Correct 1473 ms 86392 KB Output is correct
7 Correct 1014 ms 59488 KB Output is correct
8 Correct 1259 ms 86456 KB Output is correct
9 Correct 1 ms 772 KB Output is correct
10 Correct 1 ms 720 KB Output is correct
11 Correct 1 ms 720 KB Output is correct
12 Correct 1 ms 720 KB Output is correct
13 Correct 2 ms 720 KB Output is correct
14 Correct 2 ms 848 KB Output is correct
15 Correct 2 ms 860 KB Output is correct
16 Correct 3 ms 720 KB Output is correct
17 Correct 1 ms 720 KB Output is correct
18 Correct 3 ms 720 KB Output is correct
19 Correct 3 ms 720 KB Output is correct
20 Correct 3 ms 720 KB Output is correct
21 Correct 3 ms 720 KB Output is correct
22 Correct 3 ms 720 KB Output is correct
23 Correct 4 ms 848 KB Output is correct
24 Correct 2 ms 832 KB Output is correct
25 Correct 2 ms 720 KB Output is correct
26 Correct 1 ms 720 KB Output is correct
27 Correct 1 ms 720 KB Output is correct
28 Correct 4 ms 848 KB Output is correct
29 Correct 2 ms 720 KB Output is correct
30 Correct 2 ms 740 KB Output is correct
31 Correct 3 ms 848 KB Output is correct
32 Correct 3 ms 848 KB Output is correct
33 Correct 0 ms 720 KB Output is correct
34 Correct 1 ms 720 KB Output is correct
35 Correct 2 ms 720 KB Output is correct
36 Correct 2 ms 720 KB Output is correct
37 Correct 3 ms 848 KB Output is correct
38 Correct 2 ms 720 KB Output is correct
39 Correct 2 ms 848 KB Output is correct
40 Correct 3 ms 720 KB Output is correct
41 Correct 1 ms 768 KB Output is correct
42 Correct 1 ms 720 KB Output is correct
43 Correct 1 ms 720 KB Output is correct
44 Correct 1 ms 720 KB Output is correct
45 Correct 1 ms 896 KB Output is correct
46 Correct 1 ms 716 KB Output is correct
47 Correct 1 ms 896 KB Output is correct
48 Correct 1 ms 720 KB Output is correct
49 Correct 1 ms 720 KB Output is correct
50 Correct 1 ms 720 KB Output is correct
51 Correct 1 ms 720 KB Output is correct
52 Correct 3 ms 720 KB Output is correct
53 Correct 3 ms 720 KB Output is correct
54 Correct 2 ms 720 KB Output is correct
55 Correct 2 ms 720 KB Output is correct
56 Correct 1 ms 720 KB Output is correct
57 Correct 2 ms 720 KB Output is correct
58 Correct 3 ms 720 KB Output is correct
59 Correct 3 ms 848 KB Output is correct
60 Correct 3 ms 720 KB Output is correct
61 Correct 3 ms 720 KB Output is correct
62 Correct 4 ms 720 KB Output is correct
63 Correct 5 ms 720 KB Output is correct
64 Correct 2 ms 848 KB Output is correct
65 Correct 1 ms 720 KB Output is correct
66 Correct 23 ms 1360 KB Output is correct
67 Correct 25 ms 1604 KB Output is correct
68 Correct 7 ms 1104 KB Output is correct
69 Correct 23 ms 1488 KB Output is correct
70 Correct 14 ms 720 KB Output is correct
71 Correct 20 ms 1488 KB Output is correct
72 Correct 22 ms 1488 KB Output is correct
73 Correct 21 ms 1616 KB Output is correct
74 Correct 20 ms 1616 KB Output is correct
75 Correct 14 ms 1488 KB Output is correct
76 Correct 23 ms 1488 KB Output is correct
77 Correct 18 ms 1488 KB Output is correct
78 Correct 21 ms 1616 KB Output is correct
79 Correct 1 ms 720 KB Output is correct
80 Correct 1 ms 720 KB Output is correct
81 Correct 3 ms 720 KB Output is correct
82 Correct 3 ms 720 KB Output is correct
83 Correct 2 ms 848 KB Output is correct
84 Correct 3 ms 720 KB Output is correct
85 Correct 3 ms 720 KB Output is correct
86 Correct 1 ms 720 KB Output is correct
87 Correct 1 ms 720 KB Output is correct
88 Correct 2 ms 720 KB Output is correct
89 Correct 3 ms 720 KB Output is correct
90 Correct 2 ms 720 KB Output is correct
91 Correct 2 ms 848 KB Output is correct
92 Correct 2 ms 720 KB Output is correct
93 Correct 3 ms 720 KB Output is correct
94 Correct 1 ms 720 KB Output is correct
95 Correct 1 ms 720 KB Output is correct
96 Correct 1 ms 896 KB Output is correct
97 Correct 1 ms 720 KB Output is correct
98 Correct 1 ms 720 KB Output is correct
99 Correct 1 ms 896 KB Output is correct
100 Correct 1 ms 720 KB Output is correct
101 Correct 1 ms 720 KB Output is correct
102 Correct 4 ms 848 KB Output is correct
103 Correct 28 ms 1488 KB Output is correct
104 Correct 26 ms 1488 KB Output is correct
105 Correct 22 ms 1488 KB Output is correct
106 Correct 19 ms 1488 KB Output is correct
107 Correct 23 ms 1616 KB Output is correct
108 Correct 1 ms 896 KB Output is correct
109 Correct 1 ms 976 KB Output is correct
110 Correct 20 ms 1488 KB Output is correct
111 Correct 26 ms 1616 KB Output is correct
112 Correct 16 ms 1488 KB Output is correct
113 Correct 21 ms 1488 KB Output is correct
114 Correct 21 ms 1616 KB Output is correct
115 Correct 1 ms 720 KB Output is correct
116 Correct 1 ms 1104 KB Output is correct
117 Correct 2 ms 1488 KB Output is correct
118 Correct 1 ms 1616 KB Output is correct
119 Correct 1 ms 1536 KB Output is correct
120 Correct 2 ms 1488 KB Output is correct
121 Correct 2 ms 1488 KB Output is correct
122 Correct 1 ms 720 KB Output is correct
123 Correct 0 ms 720 KB Output is correct
124 Correct 1 ms 720 KB Output is correct
125 Correct 1 ms 720 KB Output is correct
126 Correct 93 ms 69212 KB Output is correct
127 Correct 80 ms 85500 KB Output is correct
128 Correct 50 ms 44472 KB Output is correct
129 Correct 78 ms 85544 KB Output is correct
130 Correct 13 ms 13540 KB Output is correct
131 Correct 87 ms 85612 KB Output is correct
132 Correct 74 ms 86368 KB Output is correct
133 Correct 76 ms 85944 KB Output is correct
134 Correct 100 ms 86100 KB Output is correct
135 Correct 79 ms 85568 KB Output is correct
136 Correct 73 ms 85524 KB Output is correct
137 Correct 90 ms 85672 KB Output is correct
138 Correct 76 ms 85532 KB Output is correct
139 Correct 1 ms 720 KB Output is correct
140 Correct 1 ms 768 KB Output is correct
141 Correct 1 ms 720 KB Output is correct
142 Correct 1 ms 848 KB Output is correct
143 Correct 1 ms 720 KB Output is correct
144 Correct 1 ms 720 KB Output is correct
145 Correct 1 ms 720 KB Output is correct
146 Correct 1 ms 720 KB Output is correct
147 Correct 1 ms 1104 KB Output is correct
148 Correct 2 ms 1488 KB Output is correct
149 Correct 2 ms 1488 KB Output is correct
150 Correct 2 ms 1592 KB Output is correct
151 Correct 1 ms 1488 KB Output is correct
152 Correct 1 ms 1616 KB Output is correct
153 Correct 1 ms 720 KB Output is correct
154 Correct 85 ms 85448 KB Output is correct
155 Correct 87 ms 85540 KB Output is correct
156 Correct 97 ms 86176 KB Output is correct
157 Correct 94 ms 85648 KB Output is correct
158 Correct 94 ms 85508 KB Output is correct
159 Correct 76 ms 85604 KB Output is correct
160 Correct 1 ms 720 KB Output is correct
161 Correct 49 ms 50028 KB Output is correct
162 Correct 84 ms 85520 KB Output is correct
163 Correct 71 ms 86200 KB Output is correct
164 Correct 82 ms 85544 KB Output is correct
165 Correct 72 ms 85524 KB Output is correct
166 Correct 70 ms 85552 KB Output is correct
167 Correct 1 ms 720 KB Output is correct
168 Correct 1 ms 720 KB Output is correct
169 Correct 1 ms 720 KB Output is correct
170 Correct 228 ms 39708 KB Output is correct
171 Correct 947 ms 85504 KB Output is correct
172 Correct 585 ms 14772 KB Output is correct
173 Correct 877 ms 85588 KB Output is correct
174 Correct 668 ms 30020 KB Output is correct
175 Correct 990 ms 85548 KB Output is correct
176 Correct 1331 ms 86336 KB Output is correct
177 Correct 1244 ms 85696 KB Output is correct
178 Correct 1213 ms 86356 KB Output is correct
179 Correct 727 ms 85540 KB Output is correct
180 Correct 1266 ms 85616 KB Output is correct
181 Correct 1096 ms 85596 KB Output is correct
182 Correct 1016 ms 85620 KB Output is correct
183 Correct 1 ms 720 KB Output is correct
184 Correct 1 ms 768 KB Output is correct
185 Correct 2 ms 720 KB Output is correct
186 Correct 4 ms 896 KB Output is correct
187 Correct 3 ms 848 KB Output is correct
188 Correct 3 ms 720 KB Output is correct
189 Correct 4 ms 848 KB Output is correct
190 Correct 3 ms 720 KB Output is correct
191 Correct 1 ms 720 KB Output is correct
192 Correct 1 ms 976 KB Output is correct
193 Correct 22 ms 1488 KB Output is correct
194 Correct 21 ms 1616 KB Output is correct
195 Correct 18 ms 1488 KB Output is correct
196 Correct 14 ms 1616 KB Output is correct
197 Correct 18 ms 1664 KB Output is correct
198 Correct 1 ms 748 KB Output is correct
199 Correct 52 ms 49968 KB Output is correct
200 Correct 86 ms 85560 KB Output is correct
201 Correct 75 ms 86200 KB Output is correct
202 Correct 83 ms 85536 KB Output is correct
203 Correct 78 ms 85620 KB Output is correct
204 Correct 87 ms 85652 KB Output is correct
205 Correct 1 ms 720 KB Output is correct
206 Correct 1 ms 720 KB Output is correct
207 Correct 1 ms 720 KB Output is correct
208 Correct 213 ms 39620 KB Output is correct
209 Correct 1142 ms 85660 KB Output is correct
210 Correct 522 ms 14796 KB Output is correct
211 Correct 1180 ms 85584 KB Output is correct
212 Correct 713 ms 30032 KB Output is correct
213 Correct 966 ms 85540 KB Output is correct
214 Correct 1453 ms 86332 KB Output is correct
215 Correct 1407 ms 85688 KB Output is correct
216 Correct 1298 ms 86224 KB Output is correct
217 Correct 982 ms 85540 KB Output is correct
218 Correct 1227 ms 85644 KB Output is correct
219 Correct 995 ms 85560 KB Output is correct
220 Correct 788 ms 85576 KB Output is correct
221 Correct 1 ms 720 KB Output is correct
222 Correct 148 ms 85416 KB Output is correct
223 Correct 960 ms 85600 KB Output is correct
224 Correct 416 ms 15624 KB Output is correct
225 Correct 914 ms 85576 KB Output is correct
226 Correct 339 ms 30956 KB Output is correct
227 Correct 922 ms 85608 KB Output is correct
228 Correct 1342 ms 86428 KB Output is correct
229 Correct 1018 ms 85908 KB Output is correct
230 Correct 1285 ms 86016 KB Output is correct
231 Correct 1268 ms 85540 KB Output is correct
232 Correct 1606 ms 85548 KB Output is correct
233 Correct 1277 ms 85516 KB Output is correct
234 Correct 988 ms 85528 KB Output is correct
235 Correct 1 ms 720 KB Output is correct
236 Correct 1 ms 720 KB Output is correct
237 Correct 3 ms 720 KB Output is correct
238 Correct 2 ms 720 KB Output is correct
239 Correct 2 ms 720 KB Output is correct
240 Correct 2 ms 720 KB Output is correct
241 Correct 2 ms 720 KB Output is correct
242 Correct 1 ms 720 KB Output is correct
243 Correct 0 ms 720 KB Output is correct
244 Correct 2 ms 720 KB Output is correct
245 Correct 3 ms 720 KB Output is correct
246 Correct 3 ms 720 KB Output is correct
247 Correct 3 ms 720 KB Output is correct
248 Correct 3 ms 720 KB Output is correct
249 Correct 2 ms 720 KB Output is correct
250 Correct 1 ms 720 KB Output is correct
251 Correct 4 ms 848 KB Output is correct
252 Correct 17 ms 1488 KB Output is correct
253 Correct 18 ms 1488 KB Output is correct
254 Correct 22 ms 1488 KB Output is correct
255 Correct 11 ms 1488 KB Output is correct
256 Correct 16 ms 1488 KB Output is correct
257 Correct 1 ms 720 KB Output is correct
258 Correct 1 ms 976 KB Output is correct
259 Correct 21 ms 1488 KB Output is correct
260 Correct 21 ms 1488 KB Output is correct
261 Correct 14 ms 1488 KB Output is correct
262 Correct 19 ms 1616 KB Output is correct
263 Correct 15 ms 1616 KB Output is correct
264 Correct 0 ms 720 KB Output is correct
265 Correct 81 ms 85564 KB Output is correct
266 Correct 84 ms 85548 KB Output is correct
267 Correct 71 ms 86204 KB Output is correct
268 Correct 75 ms 85576 KB Output is correct
269 Correct 81 ms 85604 KB Output is correct
270 Correct 69 ms 85572 KB Output is correct
271 Correct 1 ms 720 KB Output is correct
272 Correct 53 ms 49960 KB Output is correct
273 Correct 79 ms 85560 KB Output is correct
274 Correct 72 ms 86220 KB Output is correct
275 Correct 77 ms 85508 KB Output is correct
276 Correct 87 ms 85512 KB Output is correct
277 Correct 82 ms 85540 KB Output is correct
278 Correct 0 ms 720 KB Output is correct
279 Correct 1 ms 720 KB Output is correct
280 Correct 0 ms 720 KB Output is correct
281 Correct 170 ms 69104 KB Output is correct
282 Correct 1260 ms 86448 KB Output is correct
283 Correct 966 ms 43956 KB Output is correct
284 Correct 1128 ms 86444 KB Output is correct
285 Correct 1137 ms 59460 KB Output is correct
286 Correct 1251 ms 86400 KB Output is correct
287 Correct 0 ms 720 KB Output is correct
288 Correct 1 ms 720 KB Output is correct
289 Correct 1 ms 720 KB Output is correct
290 Correct 2 ms 720 KB Output is correct
291 Correct 3 ms 720 KB Output is correct
292 Correct 2 ms 720 KB Output is correct
293 Correct 3 ms 720 KB Output is correct
294 Correct 1 ms 720 KB Output is correct
295 Correct 3 ms 720 KB Output is correct
296 Correct 3 ms 720 KB Output is correct
297 Correct 3 ms 720 KB Output is correct
298 Correct 2 ms 720 KB Output is correct
299 Correct 3 ms 720 KB Output is correct
300 Correct 2 ms 720 KB Output is correct
301 Correct 3 ms 848 KB Output is correct
302 Correct 3 ms 720 KB Output is correct
303 Correct 1 ms 720 KB Output is correct
304 Correct 16 ms 1360 KB Output is correct
305 Correct 21 ms 1488 KB Output is correct
306 Correct 4 ms 1104 KB Output is correct
307 Correct 22 ms 1488 KB Output is correct
308 Correct 12 ms 720 KB Output is correct
309 Correct 18 ms 1488 KB Output is correct
310 Correct 19 ms 1488 KB Output is correct
311 Correct 23 ms 1616 KB Output is correct
312 Correct 23 ms 1616 KB Output is correct
313 Correct 24 ms 1488 KB Output is correct
314 Correct 24 ms 1616 KB Output is correct
315 Correct 17 ms 1616 KB Output is correct
316 Correct 23 ms 1616 KB Output is correct
317 Correct 0 ms 720 KB Output is correct
318 Correct 0 ms 720 KB Output is correct
319 Correct 1 ms 720 KB Output is correct
320 Correct 68 ms 69156 KB Output is correct
321 Correct 96 ms 85556 KB Output is correct
322 Correct 55 ms 44340 KB Output is correct
323 Correct 94 ms 85628 KB Output is correct
324 Correct 14 ms 13520 KB Output is correct
325 Correct 85 ms 85504 KB Output is correct
326 Correct 74 ms 86332 KB Output is correct
327 Correct 76 ms 85928 KB Output is correct
328 Correct 74 ms 86152 KB Output is correct
329 Correct 78 ms 85572 KB Output is correct
330 Correct 96 ms 85628 KB Output is correct
331 Correct 81 ms 85532 KB Output is correct
332 Correct 80 ms 85524 KB Output is correct
333 Correct 1 ms 720 KB Output is correct
334 Correct 1 ms 720 KB Output is correct
335 Correct 0 ms 720 KB Output is correct
336 Correct 278 ms 39576 KB Output is correct
337 Correct 936 ms 85512 KB Output is correct
338 Correct 571 ms 14800 KB Output is correct
339 Correct 789 ms 85576 KB Output is correct
340 Correct 588 ms 30024 KB Output is correct
341 Correct 1020 ms 85576 KB Output is correct
342 Correct 1195 ms 86344 KB Output is correct
343 Correct 1286 ms 85704 KB Output is correct
344 Correct 1028 ms 86312 KB Output is correct
345 Correct 1095 ms 85512 KB Output is correct
346 Correct 1215 ms 85524 KB Output is correct
347 Correct 779 ms 85544 KB Output is correct
348 Correct 879 ms 85576 KB Output is correct
349 Correct 1 ms 720 KB Output is correct
350 Correct 134 ms 85524 KB Output is correct
351 Correct 760 ms 85672 KB Output is correct
352 Correct 541 ms 15696 KB Output is correct
353 Correct 1083 ms 85600 KB Output is correct
354 Correct 452 ms 30924 KB Output is correct
355 Correct 897 ms 85568 KB Output is correct
356 Correct 1209 ms 86472 KB Output is correct
357 Correct 1171 ms 85828 KB Output is correct
358 Correct 1122 ms 85960 KB Output is correct
359 Correct 987 ms 85572 KB Output is correct
360 Correct 1192 ms 85620 KB Output is correct
361 Correct 883 ms 85636 KB Output is correct
362 Correct 1012 ms 85564 KB Output is correct
363 Correct 1 ms 720 KB Output is correct
364 Correct 467 ms 46284 KB Output is correct
365 Correct 1060 ms 85576 KB Output is correct
366 Correct 366 ms 61656 KB Output is correct
367 Correct 1062 ms 85552 KB Output is correct
368 Correct 381 ms 35656 KB Output is correct
369 Correct 949 ms 85544 KB Output is correct
370 Correct 1291 ms 86344 KB Output is correct
371 Correct 852 ms 86088 KB Output is correct
372 Correct 1203 ms 85952 KB Output is correct
373 Correct 933 ms 85620 KB Output is correct
374 Correct 1209 ms 85512 KB Output is correct
375 Correct 1313 ms 85576 KB Output is correct
376 Correct 1165 ms 85572 KB Output is correct
377 Correct 1 ms 720 KB Output is correct
378 Correct 1 ms 720 KB Output is correct
379 Correct 2 ms 720 KB Output is correct
380 Correct 3 ms 720 KB Output is correct
381 Correct 1 ms 848 KB Output is correct
382 Correct 3 ms 720 KB Output is correct
383 Correct 2 ms 720 KB Output is correct
384 Correct 1 ms 720 KB Output is correct
385 Correct 1 ms 720 KB Output is correct
386 Correct 2 ms 720 KB Output is correct
387 Correct 2 ms 848 KB Output is correct
388 Correct 3 ms 720 KB Output is correct
389 Correct 2 ms 720 KB Output is correct
390 Correct 3 ms 720 KB Output is correct
391 Correct 3 ms 720 KB Output is correct
392 Correct 1 ms 720 KB Output is correct
393 Correct 1 ms 720 KB Output is correct
394 Correct 1 ms 720 KB Output is correct
395 Correct 1 ms 848 KB Output is correct
396 Correct 1 ms 848 KB Output is correct
397 Correct 1 ms 832 KB Output is correct
398 Correct 1 ms 720 KB Output is correct
399 Correct 1 ms 720 KB Output is correct
400 Correct 4 ms 848 KB Output is correct
401 Correct 18 ms 1488 KB Output is correct
402 Correct 18 ms 1488 KB Output is correct
403 Correct 19 ms 1488 KB Output is correct
404 Correct 20 ms 1488 KB Output is correct
405 Correct 17 ms 1488 KB Output is correct
406 Correct 1 ms 720 KB Output is correct
407 Correct 1 ms 1072 KB Output is correct
408 Correct 15 ms 1488 KB Output is correct
409 Correct 16 ms 1616 KB Output is correct
410 Correct 16 ms 1488 KB Output is correct
411 Correct 19 ms 1488 KB Output is correct
412 Correct 19 ms 1488 KB Output is correct
413 Correct 1 ms 720 KB Output is correct
414 Correct 1 ms 1104 KB Output is correct
415 Correct 1 ms 1488 KB Output is correct
416 Correct 2 ms 1616 KB Output is correct
417 Correct 1 ms 1488 KB Output is correct
418 Correct 1 ms 1488 KB Output is correct
419 Correct 2 ms 1488 KB Output is correct
420 Correct 1 ms 720 KB Output is correct
421 Correct 80 ms 85668 KB Output is correct
422 Correct 83 ms 85568 KB Output is correct
423 Correct 70 ms 86220 KB Output is correct
424 Correct 76 ms 85532 KB Output is correct
425 Correct 75 ms 85508 KB Output is correct
426 Correct 69 ms 85564 KB Output is correct
427 Correct 0 ms 720 KB Output is correct
428 Correct 53 ms 50044 KB Output is correct
429 Correct 77 ms 85528 KB Output is correct
430 Correct 70 ms 86232 KB Output is correct
431 Correct 79 ms 85548 KB Output is correct
432 Correct 72 ms 85632 KB Output is correct
433 Correct 89 ms 85568 KB Output is correct