#include <stdio.h>
#include <string.h>
#define N 300000
#define Q 50000
#define A 300000
#define B 1341
#define INF 0x3f3f3f3f
unsigned int X = 12345;
int rand_() {
return (X *= 3) >> 1;
}
long long f(int n, int n_) {
return (long long) n * (n + 1) / 2 + (long long) (n_ - n) * (n_ - n + 1) / 2;
}
int cc[N + 1], 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 h, 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])
for (h = 0; h < cc[k] && j - i > k; h++)
if (i < r - l + 1 - j)
x -= f(i += k, r - l + 1);
else
x -= f(j -= k, r - l + 1);
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:132:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
132 | scanf("%d%d", &n, &q);
| ^~~~~~~~~~~~~~~~~~~~~
diversity.c:134:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
134 | scanf("%d", &aa[i]);
| ^~~~~~~~~~~~~~~~~~~
diversity.c:136:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
136 | 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 |
0 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 |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
10 ms |
1012 KB |
Output is correct |
5 |
Correct |
22 ms |
1904 KB |
Output is correct |
6 |
Correct |
30 ms |
2100 KB |
Output is correct |
7 |
Correct |
31 ms |
3272 KB |
Output is correct |
8 |
Correct |
29 ms |
1988 KB |
Output is correct |
9 |
Correct |
29 ms |
2036 KB |
Output is correct |
10 |
Correct |
29 ms |
2636 KB |
Output is correct |
11 |
Correct |
30 ms |
2308 KB |
Output is correct |
12 |
Correct |
37 ms |
1988 KB |
Output is correct |
13 |
Correct |
31 ms |
1924 KB |
Output is correct |
14 |
Correct |
29 ms |
2372 KB |
Output is correct |
15 |
Correct |
30 ms |
2264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
10 ms |
1012 KB |
Output is correct |
5 |
Correct |
22 ms |
1904 KB |
Output is correct |
6 |
Correct |
30 ms |
2100 KB |
Output is correct |
7 |
Correct |
31 ms |
3272 KB |
Output is correct |
8 |
Correct |
29 ms |
1988 KB |
Output is correct |
9 |
Correct |
29 ms |
2036 KB |
Output is correct |
10 |
Correct |
29 ms |
2636 KB |
Output is correct |
11 |
Correct |
30 ms |
2308 KB |
Output is correct |
12 |
Correct |
37 ms |
1988 KB |
Output is correct |
13 |
Correct |
31 ms |
1924 KB |
Output is correct |
14 |
Correct |
29 ms |
2372 KB |
Output is correct |
15 |
Correct |
30 ms |
2264 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
10 ms |
920 KB |
Output is correct |
20 |
Correct |
20 ms |
1348 KB |
Output is correct |
21 |
Correct |
31 ms |
2144 KB |
Output is correct |
22 |
Correct |
30 ms |
1916 KB |
Output is correct |
23 |
Correct |
30 ms |
2016 KB |
Output is correct |
24 |
Correct |
29 ms |
1860 KB |
Output is correct |
25 |
Correct |
30 ms |
1860 KB |
Output is correct |
26 |
Correct |
31 ms |
1856 KB |
Output is correct |
27 |
Correct |
30 ms |
1960 KB |
Output is correct |
28 |
Correct |
31 ms |
2308 KB |
Output is correct |
29 |
Correct |
31 ms |
2028 KB |
Output is correct |
30 |
Correct |
39 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
10 ms |
1012 KB |
Output is correct |
5 |
Correct |
22 ms |
1904 KB |
Output is correct |
6 |
Correct |
30 ms |
2100 KB |
Output is correct |
7 |
Correct |
31 ms |
3272 KB |
Output is correct |
8 |
Correct |
29 ms |
1988 KB |
Output is correct |
9 |
Correct |
29 ms |
2036 KB |
Output is correct |
10 |
Correct |
29 ms |
2636 KB |
Output is correct |
11 |
Correct |
30 ms |
2308 KB |
Output is correct |
12 |
Correct |
37 ms |
1988 KB |
Output is correct |
13 |
Correct |
31 ms |
1924 KB |
Output is correct |
14 |
Correct |
29 ms |
2372 KB |
Output is correct |
15 |
Correct |
30 ms |
2264 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
332 KB |
Output is correct |
19 |
Correct |
10 ms |
920 KB |
Output is correct |
20 |
Correct |
20 ms |
1348 KB |
Output is correct |
21 |
Correct |
31 ms |
2144 KB |
Output is correct |
22 |
Correct |
30 ms |
1916 KB |
Output is correct |
23 |
Correct |
30 ms |
2016 KB |
Output is correct |
24 |
Correct |
29 ms |
1860 KB |
Output is correct |
25 |
Correct |
30 ms |
1860 KB |
Output is correct |
26 |
Correct |
31 ms |
1856 KB |
Output is correct |
27 |
Correct |
30 ms |
1960 KB |
Output is correct |
28 |
Correct |
31 ms |
2308 KB |
Output is correct |
29 |
Correct |
31 ms |
2028 KB |
Output is correct |
30 |
Correct |
39 ms |
1876 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 |
332 KB |
Output is correct |
34 |
Correct |
2 ms |
332 KB |
Output is correct |
35 |
Correct |
1 ms |
332 KB |
Output is correct |
36 |
Correct |
1 ms |
332 KB |
Output is correct |
37 |
Correct |
5 ms |
460 KB |
Output is correct |
38 |
Correct |
6 ms |
460 KB |
Output is correct |
39 |
Correct |
11 ms |
716 KB |
Output is correct |
40 |
Correct |
22 ms |
1080 KB |
Output is correct |
41 |
Correct |
31 ms |
1456 KB |
Output is correct |
42 |
Correct |
31 ms |
1496 KB |
Output is correct |
43 |
Correct |
31 ms |
1484 KB |
Output is correct |
44 |
Correct |
31 ms |
1428 KB |
Output is correct |
45 |
Correct |
36 ms |
1476 KB |
Output is correct |
46 |
Correct |
32 ms |
1384 KB |
Output is correct |
47 |
Correct |
30 ms |
1424 KB |
Output is correct |
48 |
Correct |
32 ms |
1484 KB |
Output is correct |
49 |
Correct |
32 ms |
1400 KB |
Output is correct |
50 |
Correct |
33 ms |
1484 KB |
Output is correct |
51 |
Correct |
30 ms |
1500 KB |
Output is correct |
52 |
Correct |
31 ms |
1588 KB |
Output is correct |
53 |
Correct |
32 ms |
1420 KB |
Output is correct |
54 |
Correct |
32 ms |
1468 KB |
Output is correct |
55 |
Correct |
30 ms |
1432 KB |
Output is correct |
56 |
Correct |
33 ms |
1400 KB |
Output is correct |
57 |
Correct |
30 ms |
1460 KB |
Output is correct |
58 |
Correct |
30 ms |
1388 KB |
Output is correct |
59 |
Correct |
31 ms |
1492 KB |
Output is correct |
60 |
Correct |
30 ms |
1488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 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 |
0 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
10 ms |
1012 KB |
Output is correct |
15 |
Correct |
22 ms |
1904 KB |
Output is correct |
16 |
Correct |
30 ms |
2100 KB |
Output is correct |
17 |
Correct |
31 ms |
3272 KB |
Output is correct |
18 |
Correct |
29 ms |
1988 KB |
Output is correct |
19 |
Correct |
29 ms |
2036 KB |
Output is correct |
20 |
Correct |
29 ms |
2636 KB |
Output is correct |
21 |
Correct |
30 ms |
2308 KB |
Output is correct |
22 |
Correct |
37 ms |
1988 KB |
Output is correct |
23 |
Correct |
31 ms |
1924 KB |
Output is correct |
24 |
Correct |
29 ms |
2372 KB |
Output is correct |
25 |
Correct |
30 ms |
2264 KB |
Output is correct |
26 |
Correct |
0 ms |
204 KB |
Output is correct |
27 |
Correct |
0 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
10 ms |
920 KB |
Output is correct |
30 |
Correct |
20 ms |
1348 KB |
Output is correct |
31 |
Correct |
31 ms |
2144 KB |
Output is correct |
32 |
Correct |
30 ms |
1916 KB |
Output is correct |
33 |
Correct |
30 ms |
2016 KB |
Output is correct |
34 |
Correct |
29 ms |
1860 KB |
Output is correct |
35 |
Correct |
30 ms |
1860 KB |
Output is correct |
36 |
Correct |
31 ms |
1856 KB |
Output is correct |
37 |
Correct |
30 ms |
1960 KB |
Output is correct |
38 |
Correct |
31 ms |
2308 KB |
Output is correct |
39 |
Correct |
31 ms |
2028 KB |
Output is correct |
40 |
Correct |
39 ms |
1876 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 |
332 KB |
Output is correct |
44 |
Correct |
2 ms |
332 KB |
Output is correct |
45 |
Correct |
1 ms |
332 KB |
Output is correct |
46 |
Correct |
1 ms |
332 KB |
Output is correct |
47 |
Correct |
5 ms |
460 KB |
Output is correct |
48 |
Correct |
6 ms |
460 KB |
Output is correct |
49 |
Correct |
11 ms |
716 KB |
Output is correct |
50 |
Correct |
22 ms |
1080 KB |
Output is correct |
51 |
Correct |
31 ms |
1456 KB |
Output is correct |
52 |
Correct |
31 ms |
1496 KB |
Output is correct |
53 |
Correct |
31 ms |
1484 KB |
Output is correct |
54 |
Correct |
31 ms |
1428 KB |
Output is correct |
55 |
Correct |
36 ms |
1476 KB |
Output is correct |
56 |
Correct |
32 ms |
1384 KB |
Output is correct |
57 |
Correct |
30 ms |
1424 KB |
Output is correct |
58 |
Correct |
32 ms |
1484 KB |
Output is correct |
59 |
Correct |
32 ms |
1400 KB |
Output is correct |
60 |
Correct |
33 ms |
1484 KB |
Output is correct |
61 |
Correct |
30 ms |
1500 KB |
Output is correct |
62 |
Correct |
31 ms |
1588 KB |
Output is correct |
63 |
Correct |
32 ms |
1420 KB |
Output is correct |
64 |
Correct |
32 ms |
1468 KB |
Output is correct |
65 |
Correct |
30 ms |
1432 KB |
Output is correct |
66 |
Correct |
33 ms |
1400 KB |
Output is correct |
67 |
Correct |
30 ms |
1460 KB |
Output is correct |
68 |
Correct |
30 ms |
1388 KB |
Output is correct |
69 |
Correct |
31 ms |
1492 KB |
Output is correct |
70 |
Correct |
30 ms |
1488 KB |
Output is correct |
71 |
Correct |
5 ms |
460 KB |
Output is correct |
72 |
Correct |
6 ms |
484 KB |
Output is correct |
73 |
Correct |
7 ms |
460 KB |
Output is correct |
74 |
Correct |
6 ms |
460 KB |
Output is correct |
75 |
Correct |
6 ms |
460 KB |
Output is correct |
76 |
Correct |
12 ms |
716 KB |
Output is correct |
77 |
Correct |
11 ms |
716 KB |
Output is correct |
78 |
Correct |
12 ms |
664 KB |
Output is correct |
79 |
Correct |
11 ms |
636 KB |
Output is correct |
80 |
Correct |
13 ms |
672 KB |
Output is correct |
81 |
Correct |
26 ms |
1124 KB |
Output is correct |
82 |
Correct |
21 ms |
1136 KB |
Output is correct |
83 |
Correct |
21 ms |
1136 KB |
Output is correct |
84 |
Correct |
22 ms |
1100 KB |
Output is correct |
85 |
Correct |
23 ms |
1140 KB |
Output is correct |
86 |
Correct |
23 ms |
1184 KB |
Output is correct |
87 |
Correct |
26 ms |
1068 KB |
Output is correct |
88 |
Correct |
22 ms |
1084 KB |
Output is correct |
89 |
Correct |
26 ms |
1092 KB |
Output is correct |
90 |
Correct |
22 ms |
1100 KB |
Output is correct |
91 |
Correct |
36 ms |
1852 KB |
Output is correct |
92 |
Correct |
34 ms |
1812 KB |
Output is correct |
93 |
Correct |
34 ms |
1824 KB |
Output is correct |
94 |
Correct |
33 ms |
1868 KB |
Output is correct |
95 |
Correct |
34 ms |
1824 KB |
Output is correct |
96 |
Correct |
41 ms |
2232 KB |
Output is correct |
97 |
Correct |
41 ms |
2152 KB |
Output is correct |
98 |
Correct |
39 ms |
2172 KB |
Output is correct |
99 |
Correct |
43 ms |
2220 KB |
Output is correct |
100 |
Correct |
41 ms |
2148 KB |
Output is correct |
101 |
Correct |
44 ms |
2164 KB |
Output is correct |
102 |
Correct |
41 ms |
2180 KB |
Output is correct |
103 |
Correct |
39 ms |
2244 KB |
Output is correct |
104 |
Correct |
42 ms |
2216 KB |
Output is correct |
105 |
Correct |
50 ms |
2244 KB |
Output is correct |
106 |
Correct |
41 ms |
2424 KB |
Output is correct |
107 |
Correct |
41 ms |
2356 KB |
Output is correct |
108 |
Correct |
40 ms |
2360 KB |
Output is correct |
109 |
Correct |
40 ms |
2372 KB |
Output is correct |
110 |
Correct |
40 ms |
2464 KB |
Output is correct |
111 |
Correct |
43 ms |
2452 KB |
Output is correct |
112 |
Correct |
43 ms |
2372 KB |
Output is correct |
113 |
Correct |
45 ms |
2376 KB |
Output is correct |
114 |
Correct |
40 ms |
2360 KB |
Output is correct |
115 |
Correct |
41 ms |
2404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 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 |
0 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
10 ms |
1012 KB |
Output is correct |
15 |
Correct |
22 ms |
1904 KB |
Output is correct |
16 |
Correct |
30 ms |
2100 KB |
Output is correct |
17 |
Correct |
31 ms |
3272 KB |
Output is correct |
18 |
Correct |
29 ms |
1988 KB |
Output is correct |
19 |
Correct |
29 ms |
2036 KB |
Output is correct |
20 |
Correct |
29 ms |
2636 KB |
Output is correct |
21 |
Correct |
30 ms |
2308 KB |
Output is correct |
22 |
Correct |
37 ms |
1988 KB |
Output is correct |
23 |
Correct |
31 ms |
1924 KB |
Output is correct |
24 |
Correct |
29 ms |
2372 KB |
Output is correct |
25 |
Correct |
30 ms |
2264 KB |
Output is correct |
26 |
Correct |
0 ms |
204 KB |
Output is correct |
27 |
Correct |
0 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
332 KB |
Output is correct |
29 |
Correct |
10 ms |
920 KB |
Output is correct |
30 |
Correct |
20 ms |
1348 KB |
Output is correct |
31 |
Correct |
31 ms |
2144 KB |
Output is correct |
32 |
Correct |
30 ms |
1916 KB |
Output is correct |
33 |
Correct |
30 ms |
2016 KB |
Output is correct |
34 |
Correct |
29 ms |
1860 KB |
Output is correct |
35 |
Correct |
30 ms |
1860 KB |
Output is correct |
36 |
Correct |
31 ms |
1856 KB |
Output is correct |
37 |
Correct |
30 ms |
1960 KB |
Output is correct |
38 |
Correct |
31 ms |
2308 KB |
Output is correct |
39 |
Correct |
31 ms |
2028 KB |
Output is correct |
40 |
Correct |
39 ms |
1876 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 |
332 KB |
Output is correct |
44 |
Correct |
2 ms |
332 KB |
Output is correct |
45 |
Correct |
1 ms |
332 KB |
Output is correct |
46 |
Correct |
1 ms |
332 KB |
Output is correct |
47 |
Correct |
5 ms |
460 KB |
Output is correct |
48 |
Correct |
6 ms |
460 KB |
Output is correct |
49 |
Correct |
11 ms |
716 KB |
Output is correct |
50 |
Correct |
22 ms |
1080 KB |
Output is correct |
51 |
Correct |
31 ms |
1456 KB |
Output is correct |
52 |
Correct |
31 ms |
1496 KB |
Output is correct |
53 |
Correct |
31 ms |
1484 KB |
Output is correct |
54 |
Correct |
31 ms |
1428 KB |
Output is correct |
55 |
Correct |
36 ms |
1476 KB |
Output is correct |
56 |
Correct |
32 ms |
1384 KB |
Output is correct |
57 |
Correct |
30 ms |
1424 KB |
Output is correct |
58 |
Correct |
32 ms |
1484 KB |
Output is correct |
59 |
Correct |
32 ms |
1400 KB |
Output is correct |
60 |
Correct |
33 ms |
1484 KB |
Output is correct |
61 |
Correct |
30 ms |
1500 KB |
Output is correct |
62 |
Correct |
31 ms |
1588 KB |
Output is correct |
63 |
Correct |
32 ms |
1420 KB |
Output is correct |
64 |
Correct |
32 ms |
1468 KB |
Output is correct |
65 |
Correct |
30 ms |
1432 KB |
Output is correct |
66 |
Correct |
33 ms |
1400 KB |
Output is correct |
67 |
Correct |
30 ms |
1460 KB |
Output is correct |
68 |
Correct |
30 ms |
1388 KB |
Output is correct |
69 |
Correct |
31 ms |
1492 KB |
Output is correct |
70 |
Correct |
30 ms |
1488 KB |
Output is correct |
71 |
Correct |
5 ms |
460 KB |
Output is correct |
72 |
Correct |
6 ms |
484 KB |
Output is correct |
73 |
Correct |
7 ms |
460 KB |
Output is correct |
74 |
Correct |
6 ms |
460 KB |
Output is correct |
75 |
Correct |
6 ms |
460 KB |
Output is correct |
76 |
Correct |
12 ms |
716 KB |
Output is correct |
77 |
Correct |
11 ms |
716 KB |
Output is correct |
78 |
Correct |
12 ms |
664 KB |
Output is correct |
79 |
Correct |
11 ms |
636 KB |
Output is correct |
80 |
Correct |
13 ms |
672 KB |
Output is correct |
81 |
Correct |
26 ms |
1124 KB |
Output is correct |
82 |
Correct |
21 ms |
1136 KB |
Output is correct |
83 |
Correct |
21 ms |
1136 KB |
Output is correct |
84 |
Correct |
22 ms |
1100 KB |
Output is correct |
85 |
Correct |
23 ms |
1140 KB |
Output is correct |
86 |
Correct |
23 ms |
1184 KB |
Output is correct |
87 |
Correct |
26 ms |
1068 KB |
Output is correct |
88 |
Correct |
22 ms |
1084 KB |
Output is correct |
89 |
Correct |
26 ms |
1092 KB |
Output is correct |
90 |
Correct |
22 ms |
1100 KB |
Output is correct |
91 |
Correct |
36 ms |
1852 KB |
Output is correct |
92 |
Correct |
34 ms |
1812 KB |
Output is correct |
93 |
Correct |
34 ms |
1824 KB |
Output is correct |
94 |
Correct |
33 ms |
1868 KB |
Output is correct |
95 |
Correct |
34 ms |
1824 KB |
Output is correct |
96 |
Correct |
41 ms |
2232 KB |
Output is correct |
97 |
Correct |
41 ms |
2152 KB |
Output is correct |
98 |
Correct |
39 ms |
2172 KB |
Output is correct |
99 |
Correct |
43 ms |
2220 KB |
Output is correct |
100 |
Correct |
41 ms |
2148 KB |
Output is correct |
101 |
Correct |
44 ms |
2164 KB |
Output is correct |
102 |
Correct |
41 ms |
2180 KB |
Output is correct |
103 |
Correct |
39 ms |
2244 KB |
Output is correct |
104 |
Correct |
42 ms |
2216 KB |
Output is correct |
105 |
Correct |
50 ms |
2244 KB |
Output is correct |
106 |
Correct |
41 ms |
2424 KB |
Output is correct |
107 |
Correct |
41 ms |
2356 KB |
Output is correct |
108 |
Correct |
40 ms |
2360 KB |
Output is correct |
109 |
Correct |
40 ms |
2372 KB |
Output is correct |
110 |
Correct |
40 ms |
2464 KB |
Output is correct |
111 |
Correct |
43 ms |
2452 KB |
Output is correct |
112 |
Correct |
43 ms |
2372 KB |
Output is correct |
113 |
Correct |
45 ms |
2376 KB |
Output is correct |
114 |
Correct |
40 ms |
2360 KB |
Output is correct |
115 |
Correct |
41 ms |
2404 KB |
Output is correct |
116 |
Correct |
342 ms |
1684 KB |
Output is correct |
117 |
Correct |
356 ms |
2208 KB |
Output is correct |
118 |
Correct |
365 ms |
2796 KB |
Output is correct |
119 |
Correct |
395 ms |
2852 KB |
Output is correct |
120 |
Correct |
386 ms |
2732 KB |
Output is correct |
121 |
Correct |
495 ms |
3136 KB |
Output is correct |
122 |
Correct |
556 ms |
3268 KB |
Output is correct |
123 |
Correct |
837 ms |
4164 KB |
Output is correct |
124 |
Correct |
1052 ms |
4312 KB |
Output is correct |
125 |
Correct |
1515 ms |
4292 KB |
Output is correct |
126 |
Correct |
1283 ms |
4740 KB |
Output is correct |
127 |
Correct |
1293 ms |
4804 KB |
Output is correct |
128 |
Correct |
1284 ms |
4752 KB |
Output is correct |
129 |
Correct |
1314 ms |
4784 KB |
Output is correct |
130 |
Correct |
1308 ms |
4720 KB |
Output is correct |
131 |
Correct |
1436 ms |
4936 KB |
Output is correct |
132 |
Correct |
1436 ms |
4872 KB |
Output is correct |
133 |
Correct |
1469 ms |
4928 KB |
Output is correct |
134 |
Correct |
1488 ms |
4888 KB |
Output is correct |
135 |
Correct |
1480 ms |
4884 KB |
Output is correct |
136 |
Correct |
1434 ms |
4932 KB |
Output is correct |
137 |
Correct |
1468 ms |
4932 KB |
Output is correct |
138 |
Correct |
1439 ms |
4892 KB |
Output is correct |
139 |
Correct |
1409 ms |
4860 KB |
Output is correct |
140 |
Correct |
1411 ms |
4824 KB |
Output is correct |
141 |
Correct |
1337 ms |
4884 KB |
Output is correct |
142 |
Correct |
1350 ms |
4876 KB |
Output is correct |
143 |
Correct |
1350 ms |
4884 KB |
Output is correct |
144 |
Correct |
1340 ms |
5020 KB |
Output is correct |
145 |
Correct |
1360 ms |
4884 KB |
Output is correct |
146 |
Correct |
1434 ms |
5140 KB |
Output is correct |
147 |
Correct |
1394 ms |
5140 KB |
Output is correct |
148 |
Correct |
1455 ms |
5184 KB |
Output is correct |
149 |
Correct |
1405 ms |
5144 KB |
Output is correct |
150 |
Correct |
1438 ms |
5136 KB |
Output is correct |
151 |
Correct |
1912 ms |
5240 KB |
Output is correct |
152 |
Correct |
1907 ms |
5224 KB |
Output is correct |
153 |
Correct |
1952 ms |
5184 KB |
Output is correct |
154 |
Correct |
2037 ms |
5268 KB |
Output is correct |
155 |
Correct |
2011 ms |
5188 KB |
Output is correct |
156 |
Correct |
4731 ms |
5944 KB |
Output is correct |
157 |
Correct |
4653 ms |
6020 KB |
Output is correct |
158 |
Correct |
4689 ms |
5812 KB |
Output is correct |
159 |
Correct |
4612 ms |
5824 KB |
Output is correct |
160 |
Correct |
4597 ms |
5836 KB |
Output is correct |
161 |
Correct |
3783 ms |
6216 KB |
Output is correct |
162 |
Correct |
3675 ms |
6024 KB |
Output is correct |
163 |
Correct |
3664 ms |
5936 KB |
Output is correct |
164 |
Correct |
3597 ms |
5996 KB |
Output is correct |
165 |
Correct |
3608 ms |
5920 KB |
Output is correct |
166 |
Correct |
1439 ms |
5560 KB |
Output is correct |
167 |
Correct |
1452 ms |
5440 KB |
Output is correct |
168 |
Correct |
1415 ms |
5456 KB |
Output is correct |
169 |
Correct |
1460 ms |
5524 KB |
Output is correct |
170 |
Correct |
1407 ms |
5488 KB |
Output is correct |
171 |
Correct |
1275 ms |
5412 KB |
Output is correct |
172 |
Correct |
1278 ms |
5420 KB |
Output is correct |
173 |
Correct |
1266 ms |
5520 KB |
Output is correct |
174 |
Correct |
1277 ms |
5440 KB |
Output is correct |
175 |
Correct |
1318 ms |
5508 KB |
Output is correct |