Submission #494213

# Submission time Handle Problem Language Result Execution time Memory
494213 2021-12-14T19:08:29 Z rainboy Diversity (CEOI21_diversity) C
100 / 100
1424 ms 3752 KB
#include <stdio.h>
#include <string.h>
 
#define N	300000
#define Q	50000
#define A	300000
#define B	1729
#define INF	0x3f3f3f3f
 
unsigned int X = 12345;
 
int rand_() {
	return (X *= 3) >> 1;
}
 
long long sum(int n) {
	return (long long) n * (n + 1) / 2;
}
 
long long sum2(int n) {
	return (long long) n * (n + 1) * (n * 2 + 1) / 6;
}
 
long long prog(int a, int c, int d) {
	return (long long) a * c + (long long) d * sum(c - 1);
}
 
long long prog2(int a, int c, int d) {
	return (long long) a * a * c + (long long) a * d * 2 * sum(c - 1) + (long long) d * d * sum2(c - 1);
}
 
long long fprog(int a, int b, int c, int d) {
	return (long long) b * (b + 1) / 2 * c + prog2(a, c, d) - (long long) prog(a, c, d) * b;
}
 
int aa[N];
int ll[Q], rr[Q];
 
int compare(int h1, int h2) {
	return ll[h1] / B != ll[h2] / B ? ll[h1] / B - ll[h2] / B : rr[h1] - rr[h2];
}
 
void sort(int *hh, int l, int r) {
	while (l < r) {
		int i = l, j = l, k = r, h = hh[l + rand_() % (r - l)], tmp;
 
		while (j < k) {
			int c = compare(hh[j], h);
 
			if (c == 0)
				j++;
			else if (c < 0) {
				tmp = hh[i], hh[i] = hh[j], hh[j] = tmp;
				i++, j++;
			} else {
				k--;
				tmp = hh[j], hh[j] = hh[k], hh[k] = tmp;
			}
		}
		sort(hh, l, i);
		l = k;
	}
}
 
int prev[N + 1], next[N + 1];
int cc[N + 1], kk[A + 1], l, r, d;
 
void add(int a) {
	int k = kk[a]++, p = prev[k], q = next[k];
 
	if (k == 0)
		d++;
	if (cc[k] == 1 && cc[k + 1] > 0) {
		p = prev[k], q = next[k];
		if (p != -1)
			next[p] = q;
		if (q != -1)
			prev[q] = p;
		prev[k] = next[k] = -1;
	} else if (cc[k] > 1 && cc[k + 1] == 0) {
		next[k] = k + 1, prev[k + 1] = k;
		next[k + 1] = q;
		if (q != -1)
			prev[q] = k + 1;
	} else if (cc[k] == 1 && cc[k + 1] == 0) {
		p = prev[k], q = next[k];
		prev[k + 1] = p;
		if (p != -1)
			next[p] = k + 1;
		next[k + 1] = q;
		if (q != -1)
			prev[q] = k + 1;
		prev[k] = next[k] = -1;
	}
	cc[k]--, cc[k + 1]++;
}
 
void delete(int a) {
	int k = kk[a]--, p = prev[k], q = next[k];
 
	if (k == 1)
		d--;
	if (cc[k] == 1 && cc[k - 1] > 0) {
		p = prev[k], q = next[k];
		if (p != -1)
			next[p] = q;
		if (q != -1)
			prev[q] = p;
		prev[k] = next[k] = -1;
	} else if (cc[k] > 1 && cc[k - 1] == 0) {
		prev[k] = k - 1, next[k - 1] = k;
		prev[k - 1] = p;
		if (p != -1)
			next[p] = k - 1;
	} else if (cc[k] == 1 && cc[k - 1] == 0) {
		p = prev[k], q = next[k];
		prev[k - 1] = p;
		if (p != -1)
			next[p] = k - 1;
		next[k - 1] = q;
		if (q != -1)
			prev[q] = k - 1;
		prev[k] = next[k] = -1;
	}
	cc[k]--, cc[k - 1]++;
}
 
long long solve() {
	int i, j, k;
	long long x;
 
	x = (long long) (r - l + 1) * (r - l + 2) / 2 * d;
	for (k = next[0], i = 0, j = r - l + 1; k != -1; k = next[k]) {
		int c = j - i == k * cc[k] ? cc[k] - 1 : cc[k];
 
		if (i < r - l + 1 - j) {
			x -= fprog(i + k, r - l + 1, (c + 1) / 2, k), i += k * ((c + 1) / 2);
			j -= k * (c / 2), x -= fprog(j, r - l + 1, c / 2, k);
		} else {
			x -= fprog(i + k, r - l + 1, c / 2, k), i += k * (c / 2);
			j -= k * ((c + 1) / 2), x -= fprog(j, r - l + 1, (c + 1) / 2, k);
		}
	}
	return x;
}
 
int main() {
	static long long ans[Q];
	static int hh[Q];
	int n, q, h, i;
 
	scanf("%d%d", &n, &q);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	for (h = 0; h < q; h++) {
		scanf("%d%d", &ll[h], &rr[h]), ll[h]--, rr[h]--;
		hh[h] = h;
	}
	sort(hh, 0, q);
	cc[0] = INF, prev[0] = next[0] = -1;
	for (h = 0, l = 0, r = -1; h < q; h++) {
		while (r < rr[hh[h]])
			add(aa[++r]);
		while (l > ll[hh[h]])
			add(aa[--l]);
		while (r > rr[hh[h]])
			delete(aa[r--]);
		while (l < ll[hh[h]])
			delete(aa[l++]);
		ans[hh[h]] = solve();
	}
	for (h = 0; h < q; h++)
		printf("%lld\n", ans[h]);
	return 0;
}

Compilation message

diversity.c: In function 'main':
diversity.c:152:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  152 |  scanf("%d%d", &n, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~
diversity.c:154:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  154 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
diversity.c:156:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  156 |   scanf("%d%d", &ll[h], &rr[h]), ll[h]--, rr[h]--;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 10 ms 980 KB Output is correct
5 Correct 20 ms 1916 KB Output is correct
6 Correct 29 ms 2116 KB Output is correct
7 Correct 29 ms 3320 KB Output is correct
8 Correct 28 ms 1932 KB Output is correct
9 Correct 32 ms 1988 KB Output is correct
10 Correct 29 ms 2580 KB Output is correct
11 Correct 29 ms 2292 KB Output is correct
12 Correct 29 ms 2048 KB Output is correct
13 Correct 29 ms 1936 KB Output is correct
14 Correct 31 ms 2320 KB Output is correct
15 Correct 29 ms 2196 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 10 ms 980 KB Output is correct
5 Correct 20 ms 1916 KB Output is correct
6 Correct 29 ms 2116 KB Output is correct
7 Correct 29 ms 3320 KB Output is correct
8 Correct 28 ms 1932 KB Output is correct
9 Correct 32 ms 1988 KB Output is correct
10 Correct 29 ms 2580 KB Output is correct
11 Correct 29 ms 2292 KB Output is correct
12 Correct 29 ms 2048 KB Output is correct
13 Correct 29 ms 1936 KB Output is correct
14 Correct 31 ms 2320 KB Output is correct
15 Correct 29 ms 2196 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 12 ms 844 KB Output is correct
20 Correct 22 ms 1396 KB Output is correct
21 Correct 31 ms 2056 KB Output is correct
22 Correct 31 ms 1908 KB Output is correct
23 Correct 36 ms 2056 KB Output is correct
24 Correct 32 ms 1792 KB Output is correct
25 Correct 34 ms 1880 KB Output is correct
26 Correct 33 ms 1932 KB Output is correct
27 Correct 31 ms 1988 KB Output is correct
28 Correct 30 ms 2288 KB Output is correct
29 Correct 31 ms 2016 KB Output is correct
30 Correct 31 ms 1860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 10 ms 980 KB Output is correct
5 Correct 20 ms 1916 KB Output is correct
6 Correct 29 ms 2116 KB Output is correct
7 Correct 29 ms 3320 KB Output is correct
8 Correct 28 ms 1932 KB Output is correct
9 Correct 32 ms 1988 KB Output is correct
10 Correct 29 ms 2580 KB Output is correct
11 Correct 29 ms 2292 KB Output is correct
12 Correct 29 ms 2048 KB Output is correct
13 Correct 29 ms 1936 KB Output is correct
14 Correct 31 ms 2320 KB Output is correct
15 Correct 29 ms 2196 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 12 ms 844 KB Output is correct
20 Correct 22 ms 1396 KB Output is correct
21 Correct 31 ms 2056 KB Output is correct
22 Correct 31 ms 1908 KB Output is correct
23 Correct 36 ms 2056 KB Output is correct
24 Correct 32 ms 1792 KB Output is correct
25 Correct 34 ms 1880 KB Output is correct
26 Correct 33 ms 1932 KB Output is correct
27 Correct 31 ms 1988 KB Output is correct
28 Correct 30 ms 2288 KB Output is correct
29 Correct 31 ms 2016 KB Output is correct
30 Correct 31 ms 1860 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 2 ms 332 KB Output is correct
37 Correct 10 ms 460 KB Output is correct
38 Correct 7 ms 516 KB Output is correct
39 Correct 11 ms 700 KB Output is correct
40 Correct 22 ms 1104 KB Output is correct
41 Correct 31 ms 1424 KB Output is correct
42 Correct 31 ms 1384 KB Output is correct
43 Correct 31 ms 1492 KB Output is correct
44 Correct 31 ms 1380 KB Output is correct
45 Correct 33 ms 1448 KB Output is correct
46 Correct 30 ms 1472 KB Output is correct
47 Correct 31 ms 1476 KB Output is correct
48 Correct 33 ms 1384 KB Output is correct
49 Correct 37 ms 1420 KB Output is correct
50 Correct 31 ms 1476 KB Output is correct
51 Correct 33 ms 1420 KB Output is correct
52 Correct 31 ms 1476 KB Output is correct
53 Correct 35 ms 1484 KB Output is correct
54 Correct 31 ms 1448 KB Output is correct
55 Correct 30 ms 1464 KB Output is correct
56 Correct 31 ms 1476 KB Output is correct
57 Correct 33 ms 1412 KB Output is correct
58 Correct 30 ms 1488 KB Output is correct
59 Correct 32 ms 1428 KB Output is correct
60 Correct 31 ms 1448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 10 ms 980 KB Output is correct
15 Correct 20 ms 1916 KB Output is correct
16 Correct 29 ms 2116 KB Output is correct
17 Correct 29 ms 3320 KB Output is correct
18 Correct 28 ms 1932 KB Output is correct
19 Correct 32 ms 1988 KB Output is correct
20 Correct 29 ms 2580 KB Output is correct
21 Correct 29 ms 2292 KB Output is correct
22 Correct 29 ms 2048 KB Output is correct
23 Correct 29 ms 1936 KB Output is correct
24 Correct 31 ms 2320 KB Output is correct
25 Correct 29 ms 2196 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 2 ms 332 KB Output is correct
29 Correct 12 ms 844 KB Output is correct
30 Correct 22 ms 1396 KB Output is correct
31 Correct 31 ms 2056 KB Output is correct
32 Correct 31 ms 1908 KB Output is correct
33 Correct 36 ms 2056 KB Output is correct
34 Correct 32 ms 1792 KB Output is correct
35 Correct 34 ms 1880 KB Output is correct
36 Correct 33 ms 1932 KB Output is correct
37 Correct 31 ms 1988 KB Output is correct
38 Correct 30 ms 2288 KB Output is correct
39 Correct 31 ms 2016 KB Output is correct
40 Correct 31 ms 1860 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 1 ms 332 KB Output is correct
46 Correct 2 ms 332 KB Output is correct
47 Correct 10 ms 460 KB Output is correct
48 Correct 7 ms 516 KB Output is correct
49 Correct 11 ms 700 KB Output is correct
50 Correct 22 ms 1104 KB Output is correct
51 Correct 31 ms 1424 KB Output is correct
52 Correct 31 ms 1384 KB Output is correct
53 Correct 31 ms 1492 KB Output is correct
54 Correct 31 ms 1380 KB Output is correct
55 Correct 33 ms 1448 KB Output is correct
56 Correct 30 ms 1472 KB Output is correct
57 Correct 31 ms 1476 KB Output is correct
58 Correct 33 ms 1384 KB Output is correct
59 Correct 37 ms 1420 KB Output is correct
60 Correct 31 ms 1476 KB Output is correct
61 Correct 33 ms 1420 KB Output is correct
62 Correct 31 ms 1476 KB Output is correct
63 Correct 35 ms 1484 KB Output is correct
64 Correct 31 ms 1448 KB Output is correct
65 Correct 30 ms 1464 KB Output is correct
66 Correct 31 ms 1476 KB Output is correct
67 Correct 33 ms 1412 KB Output is correct
68 Correct 30 ms 1488 KB Output is correct
69 Correct 32 ms 1428 KB Output is correct
70 Correct 31 ms 1448 KB Output is correct
71 Correct 5 ms 460 KB Output is correct
72 Correct 6 ms 460 KB Output is correct
73 Correct 5 ms 472 KB Output is correct
74 Correct 7 ms 460 KB Output is correct
75 Correct 6 ms 460 KB Output is correct
76 Correct 11 ms 716 KB Output is correct
77 Correct 11 ms 716 KB Output is correct
78 Correct 11 ms 664 KB Output is correct
79 Correct 15 ms 684 KB Output is correct
80 Correct 12 ms 680 KB Output is correct
81 Correct 21 ms 1100 KB Output is correct
82 Correct 22 ms 1064 KB Output is correct
83 Correct 23 ms 1032 KB Output is correct
84 Correct 23 ms 1028 KB Output is correct
85 Correct 22 ms 1084 KB Output is correct
86 Correct 24 ms 1112 KB Output is correct
87 Correct 27 ms 1136 KB Output is correct
88 Correct 24 ms 1136 KB Output is correct
89 Correct 24 ms 1092 KB Output is correct
90 Correct 25 ms 1164 KB Output is correct
91 Correct 37 ms 1732 KB Output is correct
92 Correct 38 ms 1752 KB Output is correct
93 Correct 35 ms 1860 KB Output is correct
94 Correct 36 ms 1860 KB Output is correct
95 Correct 35 ms 1804 KB Output is correct
96 Correct 42 ms 2244 KB Output is correct
97 Correct 42 ms 2244 KB Output is correct
98 Correct 42 ms 2212 KB Output is correct
99 Correct 42 ms 2136 KB Output is correct
100 Correct 41 ms 2124 KB Output is correct
101 Correct 42 ms 2140 KB Output is correct
102 Correct 41 ms 2168 KB Output is correct
103 Correct 41 ms 2240 KB Output is correct
104 Correct 40 ms 2200 KB Output is correct
105 Correct 43 ms 2212 KB Output is correct
106 Correct 42 ms 2456 KB Output is correct
107 Correct 40 ms 2392 KB Output is correct
108 Correct 40 ms 2384 KB Output is correct
109 Correct 43 ms 2372 KB Output is correct
110 Correct 41 ms 2356 KB Output is correct
111 Correct 40 ms 2444 KB Output is correct
112 Correct 43 ms 2372 KB Output is correct
113 Correct 41 ms 2444 KB Output is correct
114 Correct 40 ms 2372 KB Output is correct
115 Correct 42 ms 2352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 10 ms 980 KB Output is correct
15 Correct 20 ms 1916 KB Output is correct
16 Correct 29 ms 2116 KB Output is correct
17 Correct 29 ms 3320 KB Output is correct
18 Correct 28 ms 1932 KB Output is correct
19 Correct 32 ms 1988 KB Output is correct
20 Correct 29 ms 2580 KB Output is correct
21 Correct 29 ms 2292 KB Output is correct
22 Correct 29 ms 2048 KB Output is correct
23 Correct 29 ms 1936 KB Output is correct
24 Correct 31 ms 2320 KB Output is correct
25 Correct 29 ms 2196 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 2 ms 332 KB Output is correct
29 Correct 12 ms 844 KB Output is correct
30 Correct 22 ms 1396 KB Output is correct
31 Correct 31 ms 2056 KB Output is correct
32 Correct 31 ms 1908 KB Output is correct
33 Correct 36 ms 2056 KB Output is correct
34 Correct 32 ms 1792 KB Output is correct
35 Correct 34 ms 1880 KB Output is correct
36 Correct 33 ms 1932 KB Output is correct
37 Correct 31 ms 1988 KB Output is correct
38 Correct 30 ms 2288 KB Output is correct
39 Correct 31 ms 2016 KB Output is correct
40 Correct 31 ms 1860 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 1 ms 332 KB Output is correct
46 Correct 2 ms 332 KB Output is correct
47 Correct 10 ms 460 KB Output is correct
48 Correct 7 ms 516 KB Output is correct
49 Correct 11 ms 700 KB Output is correct
50 Correct 22 ms 1104 KB Output is correct
51 Correct 31 ms 1424 KB Output is correct
52 Correct 31 ms 1384 KB Output is correct
53 Correct 31 ms 1492 KB Output is correct
54 Correct 31 ms 1380 KB Output is correct
55 Correct 33 ms 1448 KB Output is correct
56 Correct 30 ms 1472 KB Output is correct
57 Correct 31 ms 1476 KB Output is correct
58 Correct 33 ms 1384 KB Output is correct
59 Correct 37 ms 1420 KB Output is correct
60 Correct 31 ms 1476 KB Output is correct
61 Correct 33 ms 1420 KB Output is correct
62 Correct 31 ms 1476 KB Output is correct
63 Correct 35 ms 1484 KB Output is correct
64 Correct 31 ms 1448 KB Output is correct
65 Correct 30 ms 1464 KB Output is correct
66 Correct 31 ms 1476 KB Output is correct
67 Correct 33 ms 1412 KB Output is correct
68 Correct 30 ms 1488 KB Output is correct
69 Correct 32 ms 1428 KB Output is correct
70 Correct 31 ms 1448 KB Output is correct
71 Correct 5 ms 460 KB Output is correct
72 Correct 6 ms 460 KB Output is correct
73 Correct 5 ms 472 KB Output is correct
74 Correct 7 ms 460 KB Output is correct
75 Correct 6 ms 460 KB Output is correct
76 Correct 11 ms 716 KB Output is correct
77 Correct 11 ms 716 KB Output is correct
78 Correct 11 ms 664 KB Output is correct
79 Correct 15 ms 684 KB Output is correct
80 Correct 12 ms 680 KB Output is correct
81 Correct 21 ms 1100 KB Output is correct
82 Correct 22 ms 1064 KB Output is correct
83 Correct 23 ms 1032 KB Output is correct
84 Correct 23 ms 1028 KB Output is correct
85 Correct 22 ms 1084 KB Output is correct
86 Correct 24 ms 1112 KB Output is correct
87 Correct 27 ms 1136 KB Output is correct
88 Correct 24 ms 1136 KB Output is correct
89 Correct 24 ms 1092 KB Output is correct
90 Correct 25 ms 1164 KB Output is correct
91 Correct 37 ms 1732 KB Output is correct
92 Correct 38 ms 1752 KB Output is correct
93 Correct 35 ms 1860 KB Output is correct
94 Correct 36 ms 1860 KB Output is correct
95 Correct 35 ms 1804 KB Output is correct
96 Correct 42 ms 2244 KB Output is correct
97 Correct 42 ms 2244 KB Output is correct
98 Correct 42 ms 2212 KB Output is correct
99 Correct 42 ms 2136 KB Output is correct
100 Correct 41 ms 2124 KB Output is correct
101 Correct 42 ms 2140 KB Output is correct
102 Correct 41 ms 2168 KB Output is correct
103 Correct 41 ms 2240 KB Output is correct
104 Correct 40 ms 2200 KB Output is correct
105 Correct 43 ms 2212 KB Output is correct
106 Correct 42 ms 2456 KB Output is correct
107 Correct 40 ms 2392 KB Output is correct
108 Correct 40 ms 2384 KB Output is correct
109 Correct 43 ms 2372 KB Output is correct
110 Correct 41 ms 2356 KB Output is correct
111 Correct 40 ms 2444 KB Output is correct
112 Correct 43 ms 2372 KB Output is correct
113 Correct 41 ms 2444 KB Output is correct
114 Correct 40 ms 2372 KB Output is correct
115 Correct 42 ms 2352 KB Output is correct
116 Correct 428 ms 1700 KB Output is correct
117 Correct 449 ms 1684 KB Output is correct
118 Correct 479 ms 1988 KB Output is correct
119 Correct 462 ms 1988 KB Output is correct
120 Correct 378 ms 1976 KB Output is correct
121 Correct 497 ms 2172 KB Output is correct
122 Correct 425 ms 2172 KB Output is correct
123 Correct 809 ms 2704 KB Output is correct
124 Correct 576 ms 2704 KB Output is correct
125 Correct 591 ms 2760 KB Output is correct
126 Correct 1268 ms 3012 KB Output is correct
127 Correct 1292 ms 3012 KB Output is correct
128 Correct 1294 ms 3036 KB Output is correct
129 Correct 1290 ms 3000 KB Output is correct
130 Correct 1311 ms 3004 KB Output is correct
131 Correct 1408 ms 3160 KB Output is correct
132 Correct 1404 ms 3100 KB Output is correct
133 Correct 1401 ms 3108 KB Output is correct
134 Correct 1394 ms 3108 KB Output is correct
135 Correct 1383 ms 3140 KB Output is correct
136 Correct 1424 ms 3144 KB Output is correct
137 Correct 1383 ms 3140 KB Output is correct
138 Correct 1403 ms 3184 KB Output is correct
139 Correct 1364 ms 3100 KB Output is correct
140 Correct 1382 ms 3128 KB Output is correct
141 Correct 1266 ms 3140 KB Output is correct
142 Correct 1261 ms 3140 KB Output is correct
143 Correct 1266 ms 3140 KB Output is correct
144 Correct 1262 ms 3148 KB Output is correct
145 Correct 1263 ms 3128 KB Output is correct
146 Correct 855 ms 3088 KB Output is correct
147 Correct 852 ms 3140 KB Output is correct
148 Correct 865 ms 3088 KB Output is correct
149 Correct 858 ms 3124 KB Output is correct
150 Correct 858 ms 3088 KB Output is correct
151 Correct 901 ms 3140 KB Output is correct
152 Correct 886 ms 3192 KB Output is correct
153 Correct 899 ms 3108 KB Output is correct
154 Correct 877 ms 3100 KB Output is correct
155 Correct 886 ms 3104 KB Output is correct
156 Correct 1402 ms 3564 KB Output is correct
157 Correct 1376 ms 3728 KB Output is correct
158 Correct 1354 ms 3456 KB Output is correct
159 Correct 1359 ms 3488 KB Output is correct
160 Correct 1390 ms 3472 KB Output is correct
161 Correct 1343 ms 3752 KB Output is correct
162 Correct 1278 ms 3652 KB Output is correct
163 Correct 1262 ms 3500 KB Output is correct
164 Correct 1281 ms 3536 KB Output is correct
165 Correct 1268 ms 3456 KB Output is correct
166 Correct 1307 ms 3280 KB Output is correct
167 Correct 1303 ms 3224 KB Output is correct
168 Correct 1305 ms 3220 KB Output is correct
169 Correct 1322 ms 3280 KB Output is correct
170 Correct 1293 ms 3244 KB Output is correct
171 Correct 1268 ms 3100 KB Output is correct
172 Correct 1285 ms 3096 KB Output is correct
173 Correct 1310 ms 3136 KB Output is correct
174 Correct 1296 ms 3140 KB Output is correct
175 Correct 1308 ms 3268 KB Output is correct