#include <cstdio>
#include <cassert>
#include <algorithm>
#include <vector>
#include <cstring>
#include <iostream>
#include <cmath>
#include <string>
#include <deque>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<
#define X first
#define Y second
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
const int MAX = 300100, SQRT = 550;
int total_freq[MAX];
int freq[MAX];
int no_small[SQRT]; //number of small values with this frequency
vector <int> Large_vals;
inline bool is_small(int val) {
return total_freq[val] < SQRT;
}
void update(int val, int change) {
if (is_small(val)) no_small[freq[val]]--;
freq[val] += change;
if (is_small(val)) no_small[freq[val]]++;
}
ll sum_squares_arithmetic(ll st, ll a, ll t) { //st^2 + (st+a)^2 + (st+2a)^2 + ... (st+(t-1)a)^2
return st*st * t + t*(t-1) * a * st + a*a * (((t-1) * t * (2*t-1))/6);
}
int tmp_no_small[SQRT];
vector <P> get_vals() {
FOR(i, 1, SQRT)
tmp_no_small[i] = no_small[i];
for (auto val : Large_vals)
if (freq[val] < SQRT) tmp_no_small[freq[val]]++;
vector <P> Vals; //could have repeated values but Vals.size() = O(sqrt(n))
FOR(i, 1, SQRT) if (tmp_no_small[i]) Vals.push_back(P(i, tmp_no_small[i]));
sort(Large_vals.begin(), Large_vals.end(), [] (const int &a, const int &b) { return freq[a] < freq[b]; });
for (auto val : Large_vals)
if (freq[val] >= SQRT)
Vals.push_back(P(freq[val], 1));
return Vals;
}
ll eval(vector <P> Vals) {
int N = 0, K = 0;
for (auto it : Vals) {
N += it.X * it.Y;
K += it.Y;
}
int curr_mod = 1;
int pref_sum[2] = {0};
ll ret = 0;
for (auto it : Vals) {
assert(it.Y > 0);
int no_new_odd = (it.Y + curr_mod) / 2;
int no_new_even = (it.Y + 1-curr_mod) / 2;
assert(no_new_odd + no_new_even == it.Y);
//odds
ret += sum_squares_arithmetic(pref_sum[1], it.X, no_new_odd);
ret += sum_squares_arithmetic(N - pref_sum[1] - it.X, -it.X, no_new_odd);
//evens
ret += sum_squares_arithmetic(pref_sum[0], it.X, no_new_even);
ret += sum_squares_arithmetic(N - pref_sum[0] - it.X, -it.X, no_new_even);
pref_sum[0] += it.X * no_new_even;
pref_sum[1] += it.X * no_new_odd;
curr_mod = (curr_mod + it.Y) % 2;
}
return ((ll)K*N*(N+1) - (ll)N*(K-1) - ret) / 2;
}
int n, q;
int p[MAX];
int qa[MAX], qb[MAX];
ll ans[MAX];
vector <int> Queries[SQRT];
void load() {
scanf("%d%d", &n, &q);
REP(i, n) scanf("%d", &p[i]);
vector <int> V(p, p+n);
sort(V.begin(), V.end());
V.resize(unique(V.begin(), V.end()) - V.begin());
REP(i, n) p[i] = (int) (lower_bound(V.begin(), V.end(), p[i]) - V.begin());
REP(i, n)
total_freq[p[i]]++;
REP(i, n)
if (total_freq[i] >= SQRT)
Large_vals.push_back(i);
REP(i, q) {
scanf("%d%d", &qa[i], &qb[i]); qa[i]--; qb[i]--;
Queries[qa[i] / SQRT].push_back(i);
}
REP(i, SQRT)
sort(Queries[i].begin(), Queries[i].end(), [] (const int &a, const int &b) { return qb[a] < qb[b]; });
}
void run(int bucket) {
memset(freq, 0, sizeof freq);
memset(no_small, 0, sizeof no_small);
vector <int> :: iterator itq = Queries[bucket].begin();
for (int i=bucket*SQRT; i<n; i++) {
update(p[i], 1);
for (; itq != Queries[bucket].end() && qb[*itq] == i; itq++) {
for (int j=bucket*SQRT; j<qa[*itq]; j++)
update(p[j], -1);
ans[*itq] = eval(get_vals());
for (int j=bucket*SQRT; j<qa[*itq]; j++)
update(p[j], 1);
}
}
}
int main()
{
load();
REP(i, SQRT) run(i);
REP(i, q) printf("%lld\n", ans[i]);
return 0;
}
Compilation message
diversity.cpp: In function 'void load()':
diversity.cpp:106:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
106 | scanf("%d%d", &n, &q);
| ~~~~~^~~~~~~~~~~~~~~~
diversity.cpp:108:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
108 | REP(i, n) scanf("%d", &p[i]);
| ~~~~~^~~~~~~~~~~~~
diversity.cpp:123:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
123 | scanf("%d%d", &qa[i], &qb[i]); qa[i]--; qb[i]--;
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
1516 KB |
Output is correct |
2 |
Correct |
24 ms |
1484 KB |
Output is correct |
3 |
Correct |
25 ms |
1508 KB |
Output is correct |
4 |
Correct |
24 ms |
1508 KB |
Output is correct |
5 |
Correct |
23 ms |
1484 KB |
Output is correct |
6 |
Correct |
23 ms |
1508 KB |
Output is correct |
7 |
Correct |
24 ms |
1484 KB |
Output is correct |
8 |
Correct |
25 ms |
1516 KB |
Output is correct |
9 |
Correct |
27 ms |
1508 KB |
Output is correct |
10 |
Correct |
24 ms |
1508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
1512 KB |
Output is correct |
2 |
Correct |
24 ms |
1520 KB |
Output is correct |
3 |
Correct |
28 ms |
1484 KB |
Output is correct |
4 |
Correct |
119 ms |
1876 KB |
Output is correct |
5 |
Correct |
370 ms |
2320 KB |
Output is correct |
6 |
Correct |
779 ms |
2740 KB |
Output is correct |
7 |
Correct |
761 ms |
2660 KB |
Output is correct |
8 |
Correct |
769 ms |
2664 KB |
Output is correct |
9 |
Correct |
759 ms |
2660 KB |
Output is correct |
10 |
Correct |
773 ms |
2892 KB |
Output is correct |
11 |
Correct |
765 ms |
2664 KB |
Output is correct |
12 |
Correct |
769 ms |
2660 KB |
Output is correct |
13 |
Correct |
783 ms |
2660 KB |
Output is correct |
14 |
Correct |
769 ms |
2664 KB |
Output is correct |
15 |
Correct |
777 ms |
2660 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
1512 KB |
Output is correct |
2 |
Correct |
24 ms |
1520 KB |
Output is correct |
3 |
Correct |
28 ms |
1484 KB |
Output is correct |
4 |
Correct |
119 ms |
1876 KB |
Output is correct |
5 |
Correct |
370 ms |
2320 KB |
Output is correct |
6 |
Correct |
779 ms |
2740 KB |
Output is correct |
7 |
Correct |
761 ms |
2660 KB |
Output is correct |
8 |
Correct |
769 ms |
2664 KB |
Output is correct |
9 |
Correct |
759 ms |
2660 KB |
Output is correct |
10 |
Correct |
773 ms |
2892 KB |
Output is correct |
11 |
Correct |
765 ms |
2664 KB |
Output is correct |
12 |
Correct |
769 ms |
2660 KB |
Output is correct |
13 |
Correct |
783 ms |
2660 KB |
Output is correct |
14 |
Correct |
769 ms |
2664 KB |
Output is correct |
15 |
Correct |
777 ms |
2660 KB |
Output is correct |
16 |
Correct |
24 ms |
1492 KB |
Output is correct |
17 |
Correct |
24 ms |
1524 KB |
Output is correct |
18 |
Correct |
27 ms |
1484 KB |
Output is correct |
19 |
Correct |
121 ms |
1876 KB |
Output is correct |
20 |
Correct |
337 ms |
2276 KB |
Output is correct |
21 |
Correct |
786 ms |
2788 KB |
Output is correct |
22 |
Correct |
783 ms |
2660 KB |
Output is correct |
23 |
Correct |
776 ms |
2724 KB |
Output is correct |
24 |
Correct |
788 ms |
2660 KB |
Output is correct |
25 |
Correct |
782 ms |
2636 KB |
Output is correct |
26 |
Correct |
793 ms |
2668 KB |
Output is correct |
27 |
Correct |
784 ms |
2660 KB |
Output is correct |
28 |
Correct |
752 ms |
2656 KB |
Output is correct |
29 |
Correct |
789 ms |
2660 KB |
Output is correct |
30 |
Correct |
767 ms |
2664 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
1512 KB |
Output is correct |
2 |
Correct |
24 ms |
1520 KB |
Output is correct |
3 |
Correct |
28 ms |
1484 KB |
Output is correct |
4 |
Correct |
119 ms |
1876 KB |
Output is correct |
5 |
Correct |
370 ms |
2320 KB |
Output is correct |
6 |
Correct |
779 ms |
2740 KB |
Output is correct |
7 |
Correct |
761 ms |
2660 KB |
Output is correct |
8 |
Correct |
769 ms |
2664 KB |
Output is correct |
9 |
Correct |
759 ms |
2660 KB |
Output is correct |
10 |
Correct |
773 ms |
2892 KB |
Output is correct |
11 |
Correct |
765 ms |
2664 KB |
Output is correct |
12 |
Correct |
769 ms |
2660 KB |
Output is correct |
13 |
Correct |
783 ms |
2660 KB |
Output is correct |
14 |
Correct |
769 ms |
2664 KB |
Output is correct |
15 |
Correct |
777 ms |
2660 KB |
Output is correct |
16 |
Correct |
24 ms |
1492 KB |
Output is correct |
17 |
Correct |
24 ms |
1524 KB |
Output is correct |
18 |
Correct |
27 ms |
1484 KB |
Output is correct |
19 |
Correct |
121 ms |
1876 KB |
Output is correct |
20 |
Correct |
337 ms |
2276 KB |
Output is correct |
21 |
Correct |
786 ms |
2788 KB |
Output is correct |
22 |
Correct |
783 ms |
2660 KB |
Output is correct |
23 |
Correct |
776 ms |
2724 KB |
Output is correct |
24 |
Correct |
788 ms |
2660 KB |
Output is correct |
25 |
Correct |
782 ms |
2636 KB |
Output is correct |
26 |
Correct |
793 ms |
2668 KB |
Output is correct |
27 |
Correct |
784 ms |
2660 KB |
Output is correct |
28 |
Correct |
752 ms |
2656 KB |
Output is correct |
29 |
Correct |
789 ms |
2660 KB |
Output is correct |
30 |
Correct |
767 ms |
2664 KB |
Output is correct |
31 |
Correct |
24 ms |
1512 KB |
Output is correct |
32 |
Correct |
24 ms |
1520 KB |
Output is correct |
33 |
Correct |
24 ms |
1484 KB |
Output is correct |
34 |
Correct |
29 ms |
1592 KB |
Output is correct |
35 |
Correct |
27 ms |
1592 KB |
Output is correct |
36 |
Correct |
27 ms |
1484 KB |
Output is correct |
37 |
Correct |
63 ms |
1688 KB |
Output is correct |
38 |
Correct |
63 ms |
1680 KB |
Output is correct |
39 |
Correct |
161 ms |
1852 KB |
Output is correct |
40 |
Correct |
558 ms |
2216 KB |
Output is correct |
41 |
Correct |
1322 ms |
2684 KB |
Output is correct |
42 |
Correct |
1324 ms |
2628 KB |
Output is correct |
43 |
Correct |
1356 ms |
2676 KB |
Output is correct |
44 |
Correct |
1361 ms |
2676 KB |
Output is correct |
45 |
Correct |
1363 ms |
2680 KB |
Output is correct |
46 |
Correct |
1310 ms |
2688 KB |
Output is correct |
47 |
Correct |
1346 ms |
2680 KB |
Output is correct |
48 |
Correct |
1331 ms |
2684 KB |
Output is correct |
49 |
Correct |
1310 ms |
2680 KB |
Output is correct |
50 |
Correct |
1300 ms |
2812 KB |
Output is correct |
51 |
Correct |
1308 ms |
2684 KB |
Output is correct |
52 |
Correct |
1315 ms |
2672 KB |
Output is correct |
53 |
Correct |
1380 ms |
2676 KB |
Output is correct |
54 |
Correct |
1370 ms |
2676 KB |
Output is correct |
55 |
Correct |
1302 ms |
2680 KB |
Output is correct |
56 |
Correct |
1372 ms |
2680 KB |
Output is correct |
57 |
Correct |
1301 ms |
2680 KB |
Output is correct |
58 |
Correct |
1360 ms |
2676 KB |
Output is correct |
59 |
Correct |
1324 ms |
2684 KB |
Output is correct |
60 |
Correct |
1317 ms |
2680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
1516 KB |
Output is correct |
2 |
Correct |
24 ms |
1484 KB |
Output is correct |
3 |
Correct |
25 ms |
1508 KB |
Output is correct |
4 |
Correct |
24 ms |
1508 KB |
Output is correct |
5 |
Correct |
23 ms |
1484 KB |
Output is correct |
6 |
Correct |
23 ms |
1508 KB |
Output is correct |
7 |
Correct |
24 ms |
1484 KB |
Output is correct |
8 |
Correct |
25 ms |
1516 KB |
Output is correct |
9 |
Correct |
27 ms |
1508 KB |
Output is correct |
10 |
Correct |
24 ms |
1508 KB |
Output is correct |
11 |
Correct |
23 ms |
1512 KB |
Output is correct |
12 |
Correct |
24 ms |
1520 KB |
Output is correct |
13 |
Correct |
28 ms |
1484 KB |
Output is correct |
14 |
Correct |
119 ms |
1876 KB |
Output is correct |
15 |
Correct |
370 ms |
2320 KB |
Output is correct |
16 |
Correct |
779 ms |
2740 KB |
Output is correct |
17 |
Correct |
761 ms |
2660 KB |
Output is correct |
18 |
Correct |
769 ms |
2664 KB |
Output is correct |
19 |
Correct |
759 ms |
2660 KB |
Output is correct |
20 |
Correct |
773 ms |
2892 KB |
Output is correct |
21 |
Correct |
765 ms |
2664 KB |
Output is correct |
22 |
Correct |
769 ms |
2660 KB |
Output is correct |
23 |
Correct |
783 ms |
2660 KB |
Output is correct |
24 |
Correct |
769 ms |
2664 KB |
Output is correct |
25 |
Correct |
777 ms |
2660 KB |
Output is correct |
26 |
Correct |
24 ms |
1492 KB |
Output is correct |
27 |
Correct |
24 ms |
1524 KB |
Output is correct |
28 |
Correct |
27 ms |
1484 KB |
Output is correct |
29 |
Correct |
121 ms |
1876 KB |
Output is correct |
30 |
Correct |
337 ms |
2276 KB |
Output is correct |
31 |
Correct |
786 ms |
2788 KB |
Output is correct |
32 |
Correct |
783 ms |
2660 KB |
Output is correct |
33 |
Correct |
776 ms |
2724 KB |
Output is correct |
34 |
Correct |
788 ms |
2660 KB |
Output is correct |
35 |
Correct |
782 ms |
2636 KB |
Output is correct |
36 |
Correct |
793 ms |
2668 KB |
Output is correct |
37 |
Correct |
784 ms |
2660 KB |
Output is correct |
38 |
Correct |
752 ms |
2656 KB |
Output is correct |
39 |
Correct |
789 ms |
2660 KB |
Output is correct |
40 |
Correct |
767 ms |
2664 KB |
Output is correct |
41 |
Correct |
24 ms |
1512 KB |
Output is correct |
42 |
Correct |
24 ms |
1520 KB |
Output is correct |
43 |
Correct |
24 ms |
1484 KB |
Output is correct |
44 |
Correct |
29 ms |
1592 KB |
Output is correct |
45 |
Correct |
27 ms |
1592 KB |
Output is correct |
46 |
Correct |
27 ms |
1484 KB |
Output is correct |
47 |
Correct |
63 ms |
1688 KB |
Output is correct |
48 |
Correct |
63 ms |
1680 KB |
Output is correct |
49 |
Correct |
161 ms |
1852 KB |
Output is correct |
50 |
Correct |
558 ms |
2216 KB |
Output is correct |
51 |
Correct |
1322 ms |
2684 KB |
Output is correct |
52 |
Correct |
1324 ms |
2628 KB |
Output is correct |
53 |
Correct |
1356 ms |
2676 KB |
Output is correct |
54 |
Correct |
1361 ms |
2676 KB |
Output is correct |
55 |
Correct |
1363 ms |
2680 KB |
Output is correct |
56 |
Correct |
1310 ms |
2688 KB |
Output is correct |
57 |
Correct |
1346 ms |
2680 KB |
Output is correct |
58 |
Correct |
1331 ms |
2684 KB |
Output is correct |
59 |
Correct |
1310 ms |
2680 KB |
Output is correct |
60 |
Correct |
1300 ms |
2812 KB |
Output is correct |
61 |
Correct |
1308 ms |
2684 KB |
Output is correct |
62 |
Correct |
1315 ms |
2672 KB |
Output is correct |
63 |
Correct |
1380 ms |
2676 KB |
Output is correct |
64 |
Correct |
1370 ms |
2676 KB |
Output is correct |
65 |
Correct |
1302 ms |
2680 KB |
Output is correct |
66 |
Correct |
1372 ms |
2680 KB |
Output is correct |
67 |
Correct |
1301 ms |
2680 KB |
Output is correct |
68 |
Correct |
1360 ms |
2676 KB |
Output is correct |
69 |
Correct |
1324 ms |
2684 KB |
Output is correct |
70 |
Correct |
1317 ms |
2680 KB |
Output is correct |
71 |
Correct |
68 ms |
1600 KB |
Output is correct |
72 |
Correct |
73 ms |
1704 KB |
Output is correct |
73 |
Correct |
66 ms |
1712 KB |
Output is correct |
74 |
Correct |
56 ms |
1672 KB |
Output is correct |
75 |
Correct |
70 ms |
1700 KB |
Output is correct |
76 |
Correct |
196 ms |
1900 KB |
Output is correct |
77 |
Correct |
179 ms |
1900 KB |
Output is correct |
78 |
Correct |
179 ms |
1904 KB |
Output is correct |
79 |
Correct |
202 ms |
1840 KB |
Output is correct |
80 |
Correct |
166 ms |
1904 KB |
Output is correct |
81 |
Correct |
567 ms |
2320 KB |
Output is correct |
82 |
Correct |
645 ms |
2356 KB |
Output is correct |
83 |
Correct |
601 ms |
2312 KB |
Output is correct |
84 |
Correct |
587 ms |
2312 KB |
Output is correct |
85 |
Correct |
590 ms |
2324 KB |
Output is correct |
86 |
Correct |
594 ms |
2372 KB |
Output is correct |
87 |
Correct |
602 ms |
2256 KB |
Output is correct |
88 |
Correct |
647 ms |
2468 KB |
Output is correct |
89 |
Correct |
649 ms |
2356 KB |
Output is correct |
90 |
Correct |
647 ms |
2484 KB |
Output is correct |
91 |
Correct |
1898 ms |
3056 KB |
Output is correct |
92 |
Correct |
1869 ms |
3052 KB |
Output is correct |
93 |
Correct |
1901 ms |
3044 KB |
Output is correct |
94 |
Correct |
1901 ms |
3052 KB |
Output is correct |
95 |
Correct |
1920 ms |
3076 KB |
Output is correct |
96 |
Correct |
2120 ms |
3616 KB |
Output is correct |
97 |
Correct |
2119 ms |
3444 KB |
Output is correct |
98 |
Correct |
2154 ms |
3436 KB |
Output is correct |
99 |
Correct |
2164 ms |
3468 KB |
Output is correct |
100 |
Correct |
2099 ms |
3440 KB |
Output is correct |
101 |
Correct |
2105 ms |
3444 KB |
Output is correct |
102 |
Correct |
2120 ms |
3460 KB |
Output is correct |
103 |
Correct |
2121 ms |
3448 KB |
Output is correct |
104 |
Correct |
2165 ms |
3480 KB |
Output is correct |
105 |
Correct |
2068 ms |
3436 KB |
Output is correct |
106 |
Correct |
1989 ms |
3636 KB |
Output is correct |
107 |
Correct |
2201 ms |
3636 KB |
Output is correct |
108 |
Correct |
2008 ms |
3652 KB |
Output is correct |
109 |
Correct |
2186 ms |
3632 KB |
Output is correct |
110 |
Correct |
2177 ms |
3636 KB |
Output is correct |
111 |
Correct |
2167 ms |
3640 KB |
Output is correct |
112 |
Correct |
2219 ms |
3636 KB |
Output is correct |
113 |
Correct |
2183 ms |
3632 KB |
Output is correct |
114 |
Correct |
2198 ms |
3704 KB |
Output is correct |
115 |
Correct |
2196 ms |
3636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
24 ms |
1516 KB |
Output is correct |
2 |
Correct |
24 ms |
1484 KB |
Output is correct |
3 |
Correct |
25 ms |
1508 KB |
Output is correct |
4 |
Correct |
24 ms |
1508 KB |
Output is correct |
5 |
Correct |
23 ms |
1484 KB |
Output is correct |
6 |
Correct |
23 ms |
1508 KB |
Output is correct |
7 |
Correct |
24 ms |
1484 KB |
Output is correct |
8 |
Correct |
25 ms |
1516 KB |
Output is correct |
9 |
Correct |
27 ms |
1508 KB |
Output is correct |
10 |
Correct |
24 ms |
1508 KB |
Output is correct |
11 |
Correct |
23 ms |
1512 KB |
Output is correct |
12 |
Correct |
24 ms |
1520 KB |
Output is correct |
13 |
Correct |
28 ms |
1484 KB |
Output is correct |
14 |
Correct |
119 ms |
1876 KB |
Output is correct |
15 |
Correct |
370 ms |
2320 KB |
Output is correct |
16 |
Correct |
779 ms |
2740 KB |
Output is correct |
17 |
Correct |
761 ms |
2660 KB |
Output is correct |
18 |
Correct |
769 ms |
2664 KB |
Output is correct |
19 |
Correct |
759 ms |
2660 KB |
Output is correct |
20 |
Correct |
773 ms |
2892 KB |
Output is correct |
21 |
Correct |
765 ms |
2664 KB |
Output is correct |
22 |
Correct |
769 ms |
2660 KB |
Output is correct |
23 |
Correct |
783 ms |
2660 KB |
Output is correct |
24 |
Correct |
769 ms |
2664 KB |
Output is correct |
25 |
Correct |
777 ms |
2660 KB |
Output is correct |
26 |
Correct |
24 ms |
1492 KB |
Output is correct |
27 |
Correct |
24 ms |
1524 KB |
Output is correct |
28 |
Correct |
27 ms |
1484 KB |
Output is correct |
29 |
Correct |
121 ms |
1876 KB |
Output is correct |
30 |
Correct |
337 ms |
2276 KB |
Output is correct |
31 |
Correct |
786 ms |
2788 KB |
Output is correct |
32 |
Correct |
783 ms |
2660 KB |
Output is correct |
33 |
Correct |
776 ms |
2724 KB |
Output is correct |
34 |
Correct |
788 ms |
2660 KB |
Output is correct |
35 |
Correct |
782 ms |
2636 KB |
Output is correct |
36 |
Correct |
793 ms |
2668 KB |
Output is correct |
37 |
Correct |
784 ms |
2660 KB |
Output is correct |
38 |
Correct |
752 ms |
2656 KB |
Output is correct |
39 |
Correct |
789 ms |
2660 KB |
Output is correct |
40 |
Correct |
767 ms |
2664 KB |
Output is correct |
41 |
Correct |
24 ms |
1512 KB |
Output is correct |
42 |
Correct |
24 ms |
1520 KB |
Output is correct |
43 |
Correct |
24 ms |
1484 KB |
Output is correct |
44 |
Correct |
29 ms |
1592 KB |
Output is correct |
45 |
Correct |
27 ms |
1592 KB |
Output is correct |
46 |
Correct |
27 ms |
1484 KB |
Output is correct |
47 |
Correct |
63 ms |
1688 KB |
Output is correct |
48 |
Correct |
63 ms |
1680 KB |
Output is correct |
49 |
Correct |
161 ms |
1852 KB |
Output is correct |
50 |
Correct |
558 ms |
2216 KB |
Output is correct |
51 |
Correct |
1322 ms |
2684 KB |
Output is correct |
52 |
Correct |
1324 ms |
2628 KB |
Output is correct |
53 |
Correct |
1356 ms |
2676 KB |
Output is correct |
54 |
Correct |
1361 ms |
2676 KB |
Output is correct |
55 |
Correct |
1363 ms |
2680 KB |
Output is correct |
56 |
Correct |
1310 ms |
2688 KB |
Output is correct |
57 |
Correct |
1346 ms |
2680 KB |
Output is correct |
58 |
Correct |
1331 ms |
2684 KB |
Output is correct |
59 |
Correct |
1310 ms |
2680 KB |
Output is correct |
60 |
Correct |
1300 ms |
2812 KB |
Output is correct |
61 |
Correct |
1308 ms |
2684 KB |
Output is correct |
62 |
Correct |
1315 ms |
2672 KB |
Output is correct |
63 |
Correct |
1380 ms |
2676 KB |
Output is correct |
64 |
Correct |
1370 ms |
2676 KB |
Output is correct |
65 |
Correct |
1302 ms |
2680 KB |
Output is correct |
66 |
Correct |
1372 ms |
2680 KB |
Output is correct |
67 |
Correct |
1301 ms |
2680 KB |
Output is correct |
68 |
Correct |
1360 ms |
2676 KB |
Output is correct |
69 |
Correct |
1324 ms |
2684 KB |
Output is correct |
70 |
Correct |
1317 ms |
2680 KB |
Output is correct |
71 |
Correct |
68 ms |
1600 KB |
Output is correct |
72 |
Correct |
73 ms |
1704 KB |
Output is correct |
73 |
Correct |
66 ms |
1712 KB |
Output is correct |
74 |
Correct |
56 ms |
1672 KB |
Output is correct |
75 |
Correct |
70 ms |
1700 KB |
Output is correct |
76 |
Correct |
196 ms |
1900 KB |
Output is correct |
77 |
Correct |
179 ms |
1900 KB |
Output is correct |
78 |
Correct |
179 ms |
1904 KB |
Output is correct |
79 |
Correct |
202 ms |
1840 KB |
Output is correct |
80 |
Correct |
166 ms |
1904 KB |
Output is correct |
81 |
Correct |
567 ms |
2320 KB |
Output is correct |
82 |
Correct |
645 ms |
2356 KB |
Output is correct |
83 |
Correct |
601 ms |
2312 KB |
Output is correct |
84 |
Correct |
587 ms |
2312 KB |
Output is correct |
85 |
Correct |
590 ms |
2324 KB |
Output is correct |
86 |
Correct |
594 ms |
2372 KB |
Output is correct |
87 |
Correct |
602 ms |
2256 KB |
Output is correct |
88 |
Correct |
647 ms |
2468 KB |
Output is correct |
89 |
Correct |
649 ms |
2356 KB |
Output is correct |
90 |
Correct |
647 ms |
2484 KB |
Output is correct |
91 |
Correct |
1898 ms |
3056 KB |
Output is correct |
92 |
Correct |
1869 ms |
3052 KB |
Output is correct |
93 |
Correct |
1901 ms |
3044 KB |
Output is correct |
94 |
Correct |
1901 ms |
3052 KB |
Output is correct |
95 |
Correct |
1920 ms |
3076 KB |
Output is correct |
96 |
Correct |
2120 ms |
3616 KB |
Output is correct |
97 |
Correct |
2119 ms |
3444 KB |
Output is correct |
98 |
Correct |
2154 ms |
3436 KB |
Output is correct |
99 |
Correct |
2164 ms |
3468 KB |
Output is correct |
100 |
Correct |
2099 ms |
3440 KB |
Output is correct |
101 |
Correct |
2105 ms |
3444 KB |
Output is correct |
102 |
Correct |
2120 ms |
3460 KB |
Output is correct |
103 |
Correct |
2121 ms |
3448 KB |
Output is correct |
104 |
Correct |
2165 ms |
3480 KB |
Output is correct |
105 |
Correct |
2068 ms |
3436 KB |
Output is correct |
106 |
Correct |
1989 ms |
3636 KB |
Output is correct |
107 |
Correct |
2201 ms |
3636 KB |
Output is correct |
108 |
Correct |
2008 ms |
3652 KB |
Output is correct |
109 |
Correct |
2186 ms |
3632 KB |
Output is correct |
110 |
Correct |
2177 ms |
3636 KB |
Output is correct |
111 |
Correct |
2167 ms |
3640 KB |
Output is correct |
112 |
Correct |
2219 ms |
3636 KB |
Output is correct |
113 |
Correct |
2183 ms |
3632 KB |
Output is correct |
114 |
Correct |
2198 ms |
3704 KB |
Output is correct |
115 |
Correct |
2196 ms |
3636 KB |
Output is correct |
116 |
Correct |
343 ms |
3064 KB |
Output is correct |
117 |
Correct |
351 ms |
3052 KB |
Output is correct |
118 |
Correct |
471 ms |
3320 KB |
Output is correct |
119 |
Correct |
446 ms |
3328 KB |
Output is correct |
120 |
Correct |
405 ms |
3316 KB |
Output is correct |
121 |
Correct |
599 ms |
3556 KB |
Output is correct |
122 |
Correct |
534 ms |
3664 KB |
Output is correct |
123 |
Correct |
1202 ms |
4080 KB |
Output is correct |
124 |
Correct |
1012 ms |
4076 KB |
Output is correct |
125 |
Correct |
1014 ms |
4100 KB |
Output is correct |
126 |
Correct |
1611 ms |
4356 KB |
Output is correct |
127 |
Correct |
1682 ms |
4356 KB |
Output is correct |
128 |
Correct |
1676 ms |
4344 KB |
Output is correct |
129 |
Correct |
1705 ms |
4348 KB |
Output is correct |
130 |
Correct |
1708 ms |
4352 KB |
Output is correct |
131 |
Correct |
1966 ms |
4480 KB |
Output is correct |
132 |
Correct |
1974 ms |
4472 KB |
Output is correct |
133 |
Correct |
1938 ms |
4468 KB |
Output is correct |
134 |
Correct |
1952 ms |
4468 KB |
Output is correct |
135 |
Correct |
2085 ms |
4468 KB |
Output is correct |
136 |
Correct |
2063 ms |
4472 KB |
Output is correct |
137 |
Correct |
1985 ms |
4480 KB |
Output is correct |
138 |
Correct |
1998 ms |
4360 KB |
Output is correct |
139 |
Correct |
2009 ms |
4480 KB |
Output is correct |
140 |
Correct |
2047 ms |
4472 KB |
Output is correct |
141 |
Correct |
2217 ms |
4488 KB |
Output is correct |
142 |
Correct |
2253 ms |
4480 KB |
Output is correct |
143 |
Correct |
2270 ms |
4484 KB |
Output is correct |
144 |
Correct |
2276 ms |
4480 KB |
Output is correct |
145 |
Correct |
2296 ms |
4492 KB |
Output is correct |
146 |
Correct |
1726 ms |
4492 KB |
Output is correct |
147 |
Correct |
1678 ms |
4476 KB |
Output is correct |
148 |
Correct |
1767 ms |
4488 KB |
Output is correct |
149 |
Correct |
1740 ms |
4512 KB |
Output is correct |
150 |
Correct |
1758 ms |
4512 KB |
Output is correct |
151 |
Correct |
1738 ms |
4732 KB |
Output is correct |
152 |
Correct |
1897 ms |
4496 KB |
Output is correct |
153 |
Correct |
1808 ms |
4500 KB |
Output is correct |
154 |
Correct |
1766 ms |
4500 KB |
Output is correct |
155 |
Correct |
1747 ms |
4512 KB |
Output is correct |
156 |
Correct |
2167 ms |
4664 KB |
Output is correct |
157 |
Correct |
2160 ms |
4664 KB |
Output is correct |
158 |
Correct |
2156 ms |
4664 KB |
Output is correct |
159 |
Correct |
2175 ms |
4660 KB |
Output is correct |
160 |
Correct |
2266 ms |
4668 KB |
Output is correct |
161 |
Correct |
2071 ms |
4572 KB |
Output is correct |
162 |
Correct |
1940 ms |
4580 KB |
Output is correct |
163 |
Correct |
2108 ms |
4600 KB |
Output is correct |
164 |
Correct |
1983 ms |
4576 KB |
Output is correct |
165 |
Correct |
1961 ms |
4576 KB |
Output is correct |
166 |
Correct |
1900 ms |
4488 KB |
Output is correct |
167 |
Correct |
1959 ms |
4476 KB |
Output is correct |
168 |
Correct |
1914 ms |
4484 KB |
Output is correct |
169 |
Correct |
1900 ms |
4472 KB |
Output is correct |
170 |
Correct |
1944 ms |
4484 KB |
Output is correct |
171 |
Correct |
1675 ms |
4348 KB |
Output is correct |
172 |
Correct |
1661 ms |
4348 KB |
Output is correct |
173 |
Correct |
1713 ms |
4440 KB |
Output is correct |
174 |
Correct |
1685 ms |
4436 KB |
Output is correct |
175 |
Correct |
1789 ms |
4344 KB |
Output is correct |