/*************************************
* author: marvinthang *
* created: 24.04.2024 16:30:43 *
*************************************/
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define left ___left
#define right ___right
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x) >> (i) & 1)
#define __builtin_popcount __builtin_popcountll
#define ALL(v) (v).begin(), (v).end()
#define REP(i, n) for (int i = 0, _n = (n); i < _n; ++i)
#define REPD(i, n) for (int i = (n); i-- > 0; )
#define FOR(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define FORD(i, b, a) for (int i = (b), _a = (a); --i >= _a; )
#define FORE(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define FORDE(i, b, a) for (int i = (b), _a = (a); i >= _a; --i)
#define scan_op(...) istream & operator >> (istream &in, __VA_ARGS__ &u)
#define print_op(...) ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#ifdef LOCAL
#include "debug.h"
#else
#define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
#define DB(...) 23
#define db(...) 23
#define debug(...) 23
#endif
template <class U, class V> scan_op(pair <U, V>) { return in >> u.first >> u.second; }
template <class T> scan_op(vector <T>) { for (size_t i = 0; i < u.size(); ++i) in >> u[i]; return in; }
template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.first << ", " << u.second << ')'; }
template <size_t i, class T> ostream & print_tuple_utils(ostream &out, const T &tup) { if constexpr(i == tuple_size<T>::value) return out << ")"; else return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup); }
template <class ...U> print_op(tuple<U...>) { return print_tuple_utils<0, tuple<U...>>(out, u); }
template <class Con, class = decltype(begin(declval<Con>()))> typename enable_if <!is_same<Con, string>::value, ostream&>::type operator << (ostream &out, const Con &con) { out << '{'; for (__typeof(con.begin()) it = con.begin(); it != con.end(); ++it) out << (it == con.begin() ? "" : ", ") << *it; return out << '}'; }
// end of template
const int MAX = 3e5 + 1;
const int BLOCK_SIZE = 500;
struct Query {
int l, r, id;
Query(int l, int r, int id): l(l), r(r), id(id) {}
bool operator < (const Query &ot) { return pair{l / BLOCK_SIZE, r} < pair{ot.l / BLOCK_SIZE, ot.r}; }
};
void process(void) {
int n, q; cin >> n >> q;
vector <int> a(n); cin >> a;
vector <int> c(ALL(a));
sort(ALL(c)); c.erase(unique(ALL(c)), c.end());
REP(i, n) a[i] = lower_bound(ALL(c), a[i]) - c.begin();
vector <int> cnt(c.size());
REP(i, n) ++cnt[a[i]];
vector <int> big;
REP(i, c.size()) if (cnt[i] >= BLOCK_SIZE) big.push_back(i);
vector <Query> queries;
REP(i, q) {
int l, r; cin >> l >> r; --l; --r;
queries.emplace_back(l, r, i);
}
sort(ALL(queries));
fill(ALL(cnt), 0);
vector <int> cnt_cnt(n + 1);
cnt_cnt[0] = c.size();
auto add = [&] (int u, int v) {
--cnt_cnt[cnt[u]];
cnt[u] += v;
++cnt_cnt[cnt[u]];
};
int cl = 0, cr = -1;
vector <long long> res(q);
for (auto [l, r, i]: queries) {
while (cl > l) add(a[--cl], +1);
while (cr < r) add(a[++cr], +1);
while (cl < l) add(a[cl++], -1);
while (cr > r) add(a[cr--], -1);
vector <pair <int, int>> left, right;
int n = 0;
FOR(i, 1, min((int) cnt_cnt.size() + 1, BLOCK_SIZE)) if (cnt_cnt[i]) {
if (n & 1) {
right.emplace_back(i, (cnt_cnt[i] + 1) / 2);
if (cnt_cnt[i] > 1) left.emplace_back(i, cnt_cnt[i] / 2);
} else {
left.emplace_back(i, (cnt_cnt[i] + 1) / 2);
if (cnt_cnt[i] > 1) right.emplace_back(i, cnt_cnt[i] / 2);
}
n += cnt_cnt[i];
}
vector <int> v;
for (int i: big) if (cnt[i] >= BLOCK_SIZE) v.push_back(cnt[i]);
sort(ALL(v));
for (int c: v) (++n & 1 ? left : right).emplace_back(c, 1);
left.insert(left.end(), right.rbegin(), right.rend());
n = r - l + 1;
int pref = 0;
for (auto [c, f]: left) {
res[i] += 1LL * f * (1LL * c * (c + 1) / 2 + 1LL * c * (n - c));
res[i] += 1LL * (n - c) * (1LL * pref * f + 1LL * f * (f - 1) / 2 * c);
res[i] -= 1LL * pref * pref * f + 1LL * pref * f * (f - 1) * c + 1LL * c * c * (f - 1) * f * (f + f - 1) / 6;
pref += c * f;
}
}
REP(i, q) cout << res[i] << '\n';
}
int main(void) {
ios_base::sync_with_stdio(false); cin.tie(nullptr); // cout.tie(nullptr);
file("diversity");
// int t; cin >> t; while (t--)
process();
// cerr << "Time elapsed: " << TIME << " s.\n";
return (0^0);
}
Compilation message
diversity.cpp: In function 'int main()':
diversity.cpp:30:61: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
30 | #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
diversity.cpp:116:2: note: in expansion of macro 'file'
116 | file("diversity");
| ^~~~
diversity.cpp:30:94: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
30 | #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
diversity.cpp:116:2: note: in expansion of macro 'file'
116 | file("diversity");
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
9 ms |
1624 KB |
Output is correct |
5 |
Correct |
17 ms |
2652 KB |
Output is correct |
6 |
Correct |
27 ms |
3924 KB |
Output is correct |
7 |
Correct |
25 ms |
3932 KB |
Output is correct |
8 |
Correct |
27 ms |
3844 KB |
Output is correct |
9 |
Correct |
26 ms |
3948 KB |
Output is correct |
10 |
Correct |
26 ms |
3932 KB |
Output is correct |
11 |
Correct |
38 ms |
4176 KB |
Output is correct |
12 |
Correct |
27 ms |
3928 KB |
Output is correct |
13 |
Correct |
27 ms |
3936 KB |
Output is correct |
14 |
Correct |
27 ms |
3928 KB |
Output is correct |
15 |
Correct |
31 ms |
3928 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
9 ms |
1624 KB |
Output is correct |
5 |
Correct |
17 ms |
2652 KB |
Output is correct |
6 |
Correct |
27 ms |
3924 KB |
Output is correct |
7 |
Correct |
25 ms |
3932 KB |
Output is correct |
8 |
Correct |
27 ms |
3844 KB |
Output is correct |
9 |
Correct |
26 ms |
3948 KB |
Output is correct |
10 |
Correct |
26 ms |
3932 KB |
Output is correct |
11 |
Correct |
38 ms |
4176 KB |
Output is correct |
12 |
Correct |
27 ms |
3928 KB |
Output is correct |
13 |
Correct |
27 ms |
3936 KB |
Output is correct |
14 |
Correct |
27 ms |
3928 KB |
Output is correct |
15 |
Correct |
31 ms |
3928 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
10 ms |
1628 KB |
Output is correct |
20 |
Correct |
20 ms |
2812 KB |
Output is correct |
21 |
Correct |
30 ms |
3828 KB |
Output is correct |
22 |
Correct |
31 ms |
3920 KB |
Output is correct |
23 |
Correct |
29 ms |
3928 KB |
Output is correct |
24 |
Correct |
30 ms |
3836 KB |
Output is correct |
25 |
Correct |
30 ms |
3928 KB |
Output is correct |
26 |
Correct |
30 ms |
3972 KB |
Output is correct |
27 |
Correct |
30 ms |
3940 KB |
Output is correct |
28 |
Correct |
29 ms |
3924 KB |
Output is correct |
29 |
Correct |
30 ms |
3928 KB |
Output is correct |
30 |
Correct |
31 ms |
3924 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
9 ms |
1624 KB |
Output is correct |
5 |
Correct |
17 ms |
2652 KB |
Output is correct |
6 |
Correct |
27 ms |
3924 KB |
Output is correct |
7 |
Correct |
25 ms |
3932 KB |
Output is correct |
8 |
Correct |
27 ms |
3844 KB |
Output is correct |
9 |
Correct |
26 ms |
3948 KB |
Output is correct |
10 |
Correct |
26 ms |
3932 KB |
Output is correct |
11 |
Correct |
38 ms |
4176 KB |
Output is correct |
12 |
Correct |
27 ms |
3928 KB |
Output is correct |
13 |
Correct |
27 ms |
3936 KB |
Output is correct |
14 |
Correct |
27 ms |
3928 KB |
Output is correct |
15 |
Correct |
31 ms |
3928 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
10 ms |
1628 KB |
Output is correct |
20 |
Correct |
20 ms |
2812 KB |
Output is correct |
21 |
Correct |
30 ms |
3828 KB |
Output is correct |
22 |
Correct |
31 ms |
3920 KB |
Output is correct |
23 |
Correct |
29 ms |
3928 KB |
Output is correct |
24 |
Correct |
30 ms |
3836 KB |
Output is correct |
25 |
Correct |
30 ms |
3928 KB |
Output is correct |
26 |
Correct |
30 ms |
3972 KB |
Output is correct |
27 |
Correct |
30 ms |
3940 KB |
Output is correct |
28 |
Correct |
29 ms |
3924 KB |
Output is correct |
29 |
Correct |
30 ms |
3928 KB |
Output is correct |
30 |
Correct |
31 ms |
3924 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
2 ms |
348 KB |
Output is correct |
35 |
Correct |
2 ms |
348 KB |
Output is correct |
36 |
Correct |
2 ms |
348 KB |
Output is correct |
37 |
Correct |
8 ms |
864 KB |
Output is correct |
38 |
Correct |
8 ms |
860 KB |
Output is correct |
39 |
Correct |
20 ms |
1616 KB |
Output is correct |
40 |
Correct |
30 ms |
2796 KB |
Output is correct |
41 |
Correct |
44 ms |
3924 KB |
Output is correct |
42 |
Correct |
44 ms |
3828 KB |
Output is correct |
43 |
Correct |
46 ms |
3920 KB |
Output is correct |
44 |
Correct |
45 ms |
3924 KB |
Output is correct |
45 |
Correct |
48 ms |
3928 KB |
Output is correct |
46 |
Correct |
44 ms |
3820 KB |
Output is correct |
47 |
Correct |
45 ms |
3820 KB |
Output is correct |
48 |
Correct |
44 ms |
3832 KB |
Output is correct |
49 |
Correct |
48 ms |
3924 KB |
Output is correct |
50 |
Correct |
44 ms |
3836 KB |
Output is correct |
51 |
Correct |
45 ms |
3832 KB |
Output is correct |
52 |
Correct |
49 ms |
3936 KB |
Output is correct |
53 |
Correct |
44 ms |
3936 KB |
Output is correct |
54 |
Correct |
45 ms |
3924 KB |
Output is correct |
55 |
Correct |
47 ms |
3836 KB |
Output is correct |
56 |
Correct |
45 ms |
3924 KB |
Output is correct |
57 |
Correct |
44 ms |
3812 KB |
Output is correct |
58 |
Correct |
44 ms |
3924 KB |
Output is correct |
59 |
Correct |
45 ms |
3836 KB |
Output is correct |
60 |
Correct |
45 ms |
3940 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
17 ms |
2652 KB |
Output is correct |
16 |
Correct |
27 ms |
3924 KB |
Output is correct |
17 |
Correct |
25 ms |
3932 KB |
Output is correct |
18 |
Correct |
27 ms |
3844 KB |
Output is correct |
19 |
Correct |
26 ms |
3948 KB |
Output is correct |
20 |
Correct |
26 ms |
3932 KB |
Output is correct |
21 |
Correct |
38 ms |
4176 KB |
Output is correct |
22 |
Correct |
27 ms |
3928 KB |
Output is correct |
23 |
Correct |
27 ms |
3936 KB |
Output is correct |
24 |
Correct |
27 ms |
3928 KB |
Output is correct |
25 |
Correct |
31 ms |
3928 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
10 ms |
1628 KB |
Output is correct |
30 |
Correct |
20 ms |
2812 KB |
Output is correct |
31 |
Correct |
30 ms |
3828 KB |
Output is correct |
32 |
Correct |
31 ms |
3920 KB |
Output is correct |
33 |
Correct |
29 ms |
3928 KB |
Output is correct |
34 |
Correct |
30 ms |
3836 KB |
Output is correct |
35 |
Correct |
30 ms |
3928 KB |
Output is correct |
36 |
Correct |
30 ms |
3972 KB |
Output is correct |
37 |
Correct |
30 ms |
3940 KB |
Output is correct |
38 |
Correct |
29 ms |
3924 KB |
Output is correct |
39 |
Correct |
30 ms |
3928 KB |
Output is correct |
40 |
Correct |
31 ms |
3924 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
2 ms |
348 KB |
Output is correct |
45 |
Correct |
2 ms |
348 KB |
Output is correct |
46 |
Correct |
2 ms |
348 KB |
Output is correct |
47 |
Correct |
8 ms |
864 KB |
Output is correct |
48 |
Correct |
8 ms |
860 KB |
Output is correct |
49 |
Correct |
20 ms |
1616 KB |
Output is correct |
50 |
Correct |
30 ms |
2796 KB |
Output is correct |
51 |
Correct |
44 ms |
3924 KB |
Output is correct |
52 |
Correct |
44 ms |
3828 KB |
Output is correct |
53 |
Correct |
46 ms |
3920 KB |
Output is correct |
54 |
Correct |
45 ms |
3924 KB |
Output is correct |
55 |
Correct |
48 ms |
3928 KB |
Output is correct |
56 |
Correct |
44 ms |
3820 KB |
Output is correct |
57 |
Correct |
45 ms |
3820 KB |
Output is correct |
58 |
Correct |
44 ms |
3832 KB |
Output is correct |
59 |
Correct |
48 ms |
3924 KB |
Output is correct |
60 |
Correct |
44 ms |
3836 KB |
Output is correct |
61 |
Correct |
45 ms |
3832 KB |
Output is correct |
62 |
Correct |
49 ms |
3936 KB |
Output is correct |
63 |
Correct |
44 ms |
3936 KB |
Output is correct |
64 |
Correct |
45 ms |
3924 KB |
Output is correct |
65 |
Correct |
47 ms |
3836 KB |
Output is correct |
66 |
Correct |
45 ms |
3924 KB |
Output is correct |
67 |
Correct |
44 ms |
3812 KB |
Output is correct |
68 |
Correct |
44 ms |
3924 KB |
Output is correct |
69 |
Correct |
45 ms |
3836 KB |
Output is correct |
70 |
Correct |
45 ms |
3940 KB |
Output is correct |
71 |
Correct |
11 ms |
860 KB |
Output is correct |
72 |
Correct |
8 ms |
860 KB |
Output is correct |
73 |
Correct |
9 ms |
924 KB |
Output is correct |
74 |
Correct |
8 ms |
856 KB |
Output is correct |
75 |
Correct |
9 ms |
860 KB |
Output is correct |
76 |
Correct |
18 ms |
1504 KB |
Output is correct |
77 |
Correct |
24 ms |
1628 KB |
Output is correct |
78 |
Correct |
18 ms |
1628 KB |
Output is correct |
79 |
Correct |
18 ms |
1628 KB |
Output is correct |
80 |
Correct |
18 ms |
1512 KB |
Output is correct |
81 |
Correct |
37 ms |
2644 KB |
Output is correct |
82 |
Correct |
40 ms |
2776 KB |
Output is correct |
83 |
Correct |
46 ms |
2800 KB |
Output is correct |
84 |
Correct |
45 ms |
2796 KB |
Output is correct |
85 |
Correct |
37 ms |
2640 KB |
Output is correct |
86 |
Correct |
44 ms |
2644 KB |
Output is correct |
87 |
Correct |
40 ms |
2780 KB |
Output is correct |
88 |
Correct |
45 ms |
2780 KB |
Output is correct |
89 |
Correct |
40 ms |
2780 KB |
Output is correct |
90 |
Correct |
40 ms |
2640 KB |
Output is correct |
91 |
Correct |
81 ms |
4176 KB |
Output is correct |
92 |
Correct |
69 ms |
4328 KB |
Output is correct |
93 |
Correct |
69 ms |
4180 KB |
Output is correct |
94 |
Correct |
70 ms |
4324 KB |
Output is correct |
95 |
Correct |
68 ms |
4328 KB |
Output is correct |
96 |
Correct |
76 ms |
4704 KB |
Output is correct |
97 |
Correct |
76 ms |
4692 KB |
Output is correct |
98 |
Correct |
78 ms |
4588 KB |
Output is correct |
99 |
Correct |
92 ms |
4688 KB |
Output is correct |
100 |
Correct |
75 ms |
4600 KB |
Output is correct |
101 |
Correct |
85 ms |
4588 KB |
Output is correct |
102 |
Correct |
76 ms |
4600 KB |
Output is correct |
103 |
Correct |
90 ms |
4692 KB |
Output is correct |
104 |
Correct |
75 ms |
4708 KB |
Output is correct |
105 |
Correct |
76 ms |
4588 KB |
Output is correct |
106 |
Correct |
77 ms |
4840 KB |
Output is correct |
107 |
Correct |
78 ms |
4712 KB |
Output is correct |
108 |
Correct |
78 ms |
4840 KB |
Output is correct |
109 |
Correct |
77 ms |
4944 KB |
Output is correct |
110 |
Correct |
77 ms |
4836 KB |
Output is correct |
111 |
Correct |
76 ms |
4836 KB |
Output is correct |
112 |
Correct |
78 ms |
4948 KB |
Output is correct |
113 |
Correct |
78 ms |
4944 KB |
Output is correct |
114 |
Correct |
77 ms |
4952 KB |
Output is correct |
115 |
Correct |
77 ms |
4944 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
9 ms |
1624 KB |
Output is correct |
15 |
Correct |
17 ms |
2652 KB |
Output is correct |
16 |
Correct |
27 ms |
3924 KB |
Output is correct |
17 |
Correct |
25 ms |
3932 KB |
Output is correct |
18 |
Correct |
27 ms |
3844 KB |
Output is correct |
19 |
Correct |
26 ms |
3948 KB |
Output is correct |
20 |
Correct |
26 ms |
3932 KB |
Output is correct |
21 |
Correct |
38 ms |
4176 KB |
Output is correct |
22 |
Correct |
27 ms |
3928 KB |
Output is correct |
23 |
Correct |
27 ms |
3936 KB |
Output is correct |
24 |
Correct |
27 ms |
3928 KB |
Output is correct |
25 |
Correct |
31 ms |
3928 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
10 ms |
1628 KB |
Output is correct |
30 |
Correct |
20 ms |
2812 KB |
Output is correct |
31 |
Correct |
30 ms |
3828 KB |
Output is correct |
32 |
Correct |
31 ms |
3920 KB |
Output is correct |
33 |
Correct |
29 ms |
3928 KB |
Output is correct |
34 |
Correct |
30 ms |
3836 KB |
Output is correct |
35 |
Correct |
30 ms |
3928 KB |
Output is correct |
36 |
Correct |
30 ms |
3972 KB |
Output is correct |
37 |
Correct |
30 ms |
3940 KB |
Output is correct |
38 |
Correct |
29 ms |
3924 KB |
Output is correct |
39 |
Correct |
30 ms |
3928 KB |
Output is correct |
40 |
Correct |
31 ms |
3924 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
348 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
2 ms |
348 KB |
Output is correct |
45 |
Correct |
2 ms |
348 KB |
Output is correct |
46 |
Correct |
2 ms |
348 KB |
Output is correct |
47 |
Correct |
8 ms |
864 KB |
Output is correct |
48 |
Correct |
8 ms |
860 KB |
Output is correct |
49 |
Correct |
20 ms |
1616 KB |
Output is correct |
50 |
Correct |
30 ms |
2796 KB |
Output is correct |
51 |
Correct |
44 ms |
3924 KB |
Output is correct |
52 |
Correct |
44 ms |
3828 KB |
Output is correct |
53 |
Correct |
46 ms |
3920 KB |
Output is correct |
54 |
Correct |
45 ms |
3924 KB |
Output is correct |
55 |
Correct |
48 ms |
3928 KB |
Output is correct |
56 |
Correct |
44 ms |
3820 KB |
Output is correct |
57 |
Correct |
45 ms |
3820 KB |
Output is correct |
58 |
Correct |
44 ms |
3832 KB |
Output is correct |
59 |
Correct |
48 ms |
3924 KB |
Output is correct |
60 |
Correct |
44 ms |
3836 KB |
Output is correct |
61 |
Correct |
45 ms |
3832 KB |
Output is correct |
62 |
Correct |
49 ms |
3936 KB |
Output is correct |
63 |
Correct |
44 ms |
3936 KB |
Output is correct |
64 |
Correct |
45 ms |
3924 KB |
Output is correct |
65 |
Correct |
47 ms |
3836 KB |
Output is correct |
66 |
Correct |
45 ms |
3924 KB |
Output is correct |
67 |
Correct |
44 ms |
3812 KB |
Output is correct |
68 |
Correct |
44 ms |
3924 KB |
Output is correct |
69 |
Correct |
45 ms |
3836 KB |
Output is correct |
70 |
Correct |
45 ms |
3940 KB |
Output is correct |
71 |
Correct |
11 ms |
860 KB |
Output is correct |
72 |
Correct |
8 ms |
860 KB |
Output is correct |
73 |
Correct |
9 ms |
924 KB |
Output is correct |
74 |
Correct |
8 ms |
856 KB |
Output is correct |
75 |
Correct |
9 ms |
860 KB |
Output is correct |
76 |
Correct |
18 ms |
1504 KB |
Output is correct |
77 |
Correct |
24 ms |
1628 KB |
Output is correct |
78 |
Correct |
18 ms |
1628 KB |
Output is correct |
79 |
Correct |
18 ms |
1628 KB |
Output is correct |
80 |
Correct |
18 ms |
1512 KB |
Output is correct |
81 |
Correct |
37 ms |
2644 KB |
Output is correct |
82 |
Correct |
40 ms |
2776 KB |
Output is correct |
83 |
Correct |
46 ms |
2800 KB |
Output is correct |
84 |
Correct |
45 ms |
2796 KB |
Output is correct |
85 |
Correct |
37 ms |
2640 KB |
Output is correct |
86 |
Correct |
44 ms |
2644 KB |
Output is correct |
87 |
Correct |
40 ms |
2780 KB |
Output is correct |
88 |
Correct |
45 ms |
2780 KB |
Output is correct |
89 |
Correct |
40 ms |
2780 KB |
Output is correct |
90 |
Correct |
40 ms |
2640 KB |
Output is correct |
91 |
Correct |
81 ms |
4176 KB |
Output is correct |
92 |
Correct |
69 ms |
4328 KB |
Output is correct |
93 |
Correct |
69 ms |
4180 KB |
Output is correct |
94 |
Correct |
70 ms |
4324 KB |
Output is correct |
95 |
Correct |
68 ms |
4328 KB |
Output is correct |
96 |
Correct |
76 ms |
4704 KB |
Output is correct |
97 |
Correct |
76 ms |
4692 KB |
Output is correct |
98 |
Correct |
78 ms |
4588 KB |
Output is correct |
99 |
Correct |
92 ms |
4688 KB |
Output is correct |
100 |
Correct |
75 ms |
4600 KB |
Output is correct |
101 |
Correct |
85 ms |
4588 KB |
Output is correct |
102 |
Correct |
76 ms |
4600 KB |
Output is correct |
103 |
Correct |
90 ms |
4692 KB |
Output is correct |
104 |
Correct |
75 ms |
4708 KB |
Output is correct |
105 |
Correct |
76 ms |
4588 KB |
Output is correct |
106 |
Correct |
77 ms |
4840 KB |
Output is correct |
107 |
Correct |
78 ms |
4712 KB |
Output is correct |
108 |
Correct |
78 ms |
4840 KB |
Output is correct |
109 |
Correct |
77 ms |
4944 KB |
Output is correct |
110 |
Correct |
77 ms |
4836 KB |
Output is correct |
111 |
Correct |
76 ms |
4836 KB |
Output is correct |
112 |
Correct |
78 ms |
4948 KB |
Output is correct |
113 |
Correct |
78 ms |
4944 KB |
Output is correct |
114 |
Correct |
77 ms |
4952 KB |
Output is correct |
115 |
Correct |
77 ms |
4944 KB |
Output is correct |
116 |
Correct |
152 ms |
1864 KB |
Output is correct |
117 |
Correct |
162 ms |
1896 KB |
Output is correct |
118 |
Correct |
199 ms |
2504 KB |
Output is correct |
119 |
Correct |
214 ms |
2504 KB |
Output is correct |
120 |
Correct |
192 ms |
2572 KB |
Output is correct |
121 |
Correct |
273 ms |
4016 KB |
Output is correct |
122 |
Correct |
240 ms |
4024 KB |
Output is correct |
123 |
Correct |
496 ms |
5524 KB |
Output is correct |
124 |
Correct |
390 ms |
5468 KB |
Output is correct |
125 |
Correct |
341 ms |
5488 KB |
Output is correct |
126 |
Correct |
905 ms |
6616 KB |
Output is correct |
127 |
Correct |
895 ms |
6616 KB |
Output is correct |
128 |
Correct |
886 ms |
6612 KB |
Output is correct |
129 |
Correct |
869 ms |
6616 KB |
Output is correct |
130 |
Correct |
871 ms |
6492 KB |
Output is correct |
131 |
Correct |
894 ms |
6620 KB |
Output is correct |
132 |
Correct |
850 ms |
6608 KB |
Output is correct |
133 |
Correct |
862 ms |
6684 KB |
Output is correct |
134 |
Correct |
840 ms |
6620 KB |
Output is correct |
135 |
Correct |
867 ms |
6884 KB |
Output is correct |
136 |
Correct |
855 ms |
6712 KB |
Output is correct |
137 |
Correct |
873 ms |
6620 KB |
Output is correct |
138 |
Correct |
840 ms |
6620 KB |
Output is correct |
139 |
Correct |
867 ms |
6624 KB |
Output is correct |
140 |
Correct |
856 ms |
6616 KB |
Output is correct |
141 |
Correct |
735 ms |
6740 KB |
Output is correct |
142 |
Correct |
755 ms |
6620 KB |
Output is correct |
143 |
Correct |
748 ms |
6620 KB |
Output is correct |
144 |
Correct |
703 ms |
6624 KB |
Output is correct |
145 |
Correct |
922 ms |
6624 KB |
Output is correct |
146 |
Correct |
643 ms |
6892 KB |
Output is correct |
147 |
Correct |
594 ms |
7012 KB |
Output is correct |
148 |
Correct |
562 ms |
6896 KB |
Output is correct |
149 |
Correct |
586 ms |
6884 KB |
Output is correct |
150 |
Correct |
607 ms |
6892 KB |
Output is correct |
151 |
Correct |
574 ms |
6916 KB |
Output is correct |
152 |
Correct |
539 ms |
7132 KB |
Output is correct |
153 |
Correct |
731 ms |
6904 KB |
Output is correct |
154 |
Correct |
512 ms |
6908 KB |
Output is correct |
155 |
Correct |
559 ms |
6884 KB |
Output is correct |
156 |
Correct |
1018 ms |
7372 KB |
Output is correct |
157 |
Correct |
1012 ms |
7332 KB |
Output is correct |
158 |
Correct |
871 ms |
7328 KB |
Output is correct |
159 |
Correct |
918 ms |
7324 KB |
Output is correct |
160 |
Correct |
918 ms |
7292 KB |
Output is correct |
161 |
Correct |
993 ms |
7244 KB |
Output is correct |
162 |
Correct |
996 ms |
7244 KB |
Output is correct |
163 |
Correct |
1063 ms |
7252 KB |
Output is correct |
164 |
Correct |
1053 ms |
7240 KB |
Output is correct |
165 |
Correct |
1014 ms |
7252 KB |
Output is correct |
166 |
Correct |
949 ms |
6880 KB |
Output is correct |
167 |
Correct |
921 ms |
6892 KB |
Output is correct |
168 |
Correct |
902 ms |
6872 KB |
Output is correct |
169 |
Correct |
986 ms |
6872 KB |
Output is correct |
170 |
Correct |
942 ms |
6880 KB |
Output is correct |
171 |
Correct |
1056 ms |
7128 KB |
Output is correct |
172 |
Correct |
1014 ms |
7900 KB |
Output is correct |
173 |
Correct |
980 ms |
7896 KB |
Output is correct |
174 |
Correct |
1089 ms |
7880 KB |
Output is correct |
175 |
Correct |
1058 ms |
7904 KB |
Output is correct |