/*************************************
* 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 = 550;
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 |
1 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 |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
456 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 |
1704 KB |
Output is correct |
5 |
Correct |
17 ms |
3160 KB |
Output is correct |
6 |
Correct |
27 ms |
4444 KB |
Output is correct |
7 |
Correct |
26 ms |
4548 KB |
Output is correct |
8 |
Correct |
27 ms |
4440 KB |
Output is correct |
9 |
Correct |
27 ms |
4444 KB |
Output is correct |
10 |
Correct |
27 ms |
4444 KB |
Output is correct |
11 |
Correct |
26 ms |
4436 KB |
Output is correct |
12 |
Correct |
28 ms |
4652 KB |
Output is correct |
13 |
Correct |
27 ms |
4432 KB |
Output is correct |
14 |
Correct |
27 ms |
4444 KB |
Output is correct |
15 |
Correct |
26 ms |
4440 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 |
1704 KB |
Output is correct |
5 |
Correct |
17 ms |
3160 KB |
Output is correct |
6 |
Correct |
27 ms |
4444 KB |
Output is correct |
7 |
Correct |
26 ms |
4548 KB |
Output is correct |
8 |
Correct |
27 ms |
4440 KB |
Output is correct |
9 |
Correct |
27 ms |
4444 KB |
Output is correct |
10 |
Correct |
27 ms |
4444 KB |
Output is correct |
11 |
Correct |
26 ms |
4436 KB |
Output is correct |
12 |
Correct |
28 ms |
4652 KB |
Output is correct |
13 |
Correct |
27 ms |
4432 KB |
Output is correct |
14 |
Correct |
27 ms |
4444 KB |
Output is correct |
15 |
Correct |
26 ms |
4440 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
10 ms |
1884 KB |
Output is correct |
20 |
Correct |
21 ms |
3224 KB |
Output is correct |
21 |
Correct |
30 ms |
4688 KB |
Output is correct |
22 |
Correct |
31 ms |
4692 KB |
Output is correct |
23 |
Correct |
30 ms |
4564 KB |
Output is correct |
24 |
Correct |
31 ms |
4688 KB |
Output is correct |
25 |
Correct |
30 ms |
4940 KB |
Output is correct |
26 |
Correct |
31 ms |
4692 KB |
Output is correct |
27 |
Correct |
30 ms |
4688 KB |
Output is correct |
28 |
Correct |
29 ms |
4436 KB |
Output is correct |
29 |
Correct |
30 ms |
4692 KB |
Output is correct |
30 |
Correct |
31 ms |
4632 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 |
1704 KB |
Output is correct |
5 |
Correct |
17 ms |
3160 KB |
Output is correct |
6 |
Correct |
27 ms |
4444 KB |
Output is correct |
7 |
Correct |
26 ms |
4548 KB |
Output is correct |
8 |
Correct |
27 ms |
4440 KB |
Output is correct |
9 |
Correct |
27 ms |
4444 KB |
Output is correct |
10 |
Correct |
27 ms |
4444 KB |
Output is correct |
11 |
Correct |
26 ms |
4436 KB |
Output is correct |
12 |
Correct |
28 ms |
4652 KB |
Output is correct |
13 |
Correct |
27 ms |
4432 KB |
Output is correct |
14 |
Correct |
27 ms |
4444 KB |
Output is correct |
15 |
Correct |
26 ms |
4440 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
10 ms |
1884 KB |
Output is correct |
20 |
Correct |
21 ms |
3224 KB |
Output is correct |
21 |
Correct |
30 ms |
4688 KB |
Output is correct |
22 |
Correct |
31 ms |
4692 KB |
Output is correct |
23 |
Correct |
30 ms |
4564 KB |
Output is correct |
24 |
Correct |
31 ms |
4688 KB |
Output is correct |
25 |
Correct |
30 ms |
4940 KB |
Output is correct |
26 |
Correct |
31 ms |
4692 KB |
Output is correct |
27 |
Correct |
30 ms |
4688 KB |
Output is correct |
28 |
Correct |
29 ms |
4436 KB |
Output is correct |
29 |
Correct |
30 ms |
4692 KB |
Output is correct |
30 |
Correct |
31 ms |
4632 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 |
344 KB |
Output is correct |
34 |
Correct |
2 ms |
604 KB |
Output is correct |
35 |
Correct |
2 ms |
604 KB |
Output is correct |
36 |
Correct |
2 ms |
604 KB |
Output is correct |
37 |
Correct |
8 ms |
1056 KB |
Output is correct |
38 |
Correct |
8 ms |
1056 KB |
Output is correct |
39 |
Correct |
15 ms |
1884 KB |
Output is correct |
40 |
Correct |
30 ms |
3412 KB |
Output is correct |
41 |
Correct |
45 ms |
4980 KB |
Output is correct |
42 |
Correct |
44 ms |
4980 KB |
Output is correct |
43 |
Correct |
49 ms |
4960 KB |
Output is correct |
44 |
Correct |
46 ms |
4976 KB |
Output is correct |
45 |
Correct |
45 ms |
4948 KB |
Output is correct |
46 |
Correct |
46 ms |
4944 KB |
Output is correct |
47 |
Correct |
44 ms |
4944 KB |
Output is correct |
48 |
Correct |
44 ms |
4976 KB |
Output is correct |
49 |
Correct |
44 ms |
4948 KB |
Output is correct |
50 |
Correct |
44 ms |
4976 KB |
Output is correct |
51 |
Correct |
44 ms |
4956 KB |
Output is correct |
52 |
Correct |
45 ms |
4948 KB |
Output is correct |
53 |
Correct |
52 ms |
5076 KB |
Output is correct |
54 |
Correct |
45 ms |
4976 KB |
Output is correct |
55 |
Correct |
45 ms |
4960 KB |
Output is correct |
56 |
Correct |
51 ms |
4944 KB |
Output is correct |
57 |
Correct |
45 ms |
4944 KB |
Output is correct |
58 |
Correct |
44 ms |
4944 KB |
Output is correct |
59 |
Correct |
50 ms |
4964 KB |
Output is correct |
60 |
Correct |
44 ms |
4960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
456 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 |
1704 KB |
Output is correct |
15 |
Correct |
17 ms |
3160 KB |
Output is correct |
16 |
Correct |
27 ms |
4444 KB |
Output is correct |
17 |
Correct |
26 ms |
4548 KB |
Output is correct |
18 |
Correct |
27 ms |
4440 KB |
Output is correct |
19 |
Correct |
27 ms |
4444 KB |
Output is correct |
20 |
Correct |
27 ms |
4444 KB |
Output is correct |
21 |
Correct |
26 ms |
4436 KB |
Output is correct |
22 |
Correct |
28 ms |
4652 KB |
Output is correct |
23 |
Correct |
27 ms |
4432 KB |
Output is correct |
24 |
Correct |
27 ms |
4444 KB |
Output is correct |
25 |
Correct |
26 ms |
4440 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
10 ms |
1884 KB |
Output is correct |
30 |
Correct |
21 ms |
3224 KB |
Output is correct |
31 |
Correct |
30 ms |
4688 KB |
Output is correct |
32 |
Correct |
31 ms |
4692 KB |
Output is correct |
33 |
Correct |
30 ms |
4564 KB |
Output is correct |
34 |
Correct |
31 ms |
4688 KB |
Output is correct |
35 |
Correct |
30 ms |
4940 KB |
Output is correct |
36 |
Correct |
31 ms |
4692 KB |
Output is correct |
37 |
Correct |
30 ms |
4688 KB |
Output is correct |
38 |
Correct |
29 ms |
4436 KB |
Output is correct |
39 |
Correct |
30 ms |
4692 KB |
Output is correct |
40 |
Correct |
31 ms |
4632 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 |
344 KB |
Output is correct |
44 |
Correct |
2 ms |
604 KB |
Output is correct |
45 |
Correct |
2 ms |
604 KB |
Output is correct |
46 |
Correct |
2 ms |
604 KB |
Output is correct |
47 |
Correct |
8 ms |
1056 KB |
Output is correct |
48 |
Correct |
8 ms |
1056 KB |
Output is correct |
49 |
Correct |
15 ms |
1884 KB |
Output is correct |
50 |
Correct |
30 ms |
3412 KB |
Output is correct |
51 |
Correct |
45 ms |
4980 KB |
Output is correct |
52 |
Correct |
44 ms |
4980 KB |
Output is correct |
53 |
Correct |
49 ms |
4960 KB |
Output is correct |
54 |
Correct |
46 ms |
4976 KB |
Output is correct |
55 |
Correct |
45 ms |
4948 KB |
Output is correct |
56 |
Correct |
46 ms |
4944 KB |
Output is correct |
57 |
Correct |
44 ms |
4944 KB |
Output is correct |
58 |
Correct |
44 ms |
4976 KB |
Output is correct |
59 |
Correct |
44 ms |
4948 KB |
Output is correct |
60 |
Correct |
44 ms |
4976 KB |
Output is correct |
61 |
Correct |
44 ms |
4956 KB |
Output is correct |
62 |
Correct |
45 ms |
4948 KB |
Output is correct |
63 |
Correct |
52 ms |
5076 KB |
Output is correct |
64 |
Correct |
45 ms |
4976 KB |
Output is correct |
65 |
Correct |
45 ms |
4960 KB |
Output is correct |
66 |
Correct |
51 ms |
4944 KB |
Output is correct |
67 |
Correct |
45 ms |
4944 KB |
Output is correct |
68 |
Correct |
44 ms |
4944 KB |
Output is correct |
69 |
Correct |
50 ms |
4964 KB |
Output is correct |
70 |
Correct |
44 ms |
4960 KB |
Output is correct |
71 |
Correct |
8 ms |
1140 KB |
Output is correct |
72 |
Correct |
9 ms |
1092 KB |
Output is correct |
73 |
Correct |
9 ms |
1116 KB |
Output is correct |
74 |
Correct |
9 ms |
1116 KB |
Output is correct |
75 |
Correct |
10 ms |
1116 KB |
Output is correct |
76 |
Correct |
19 ms |
1976 KB |
Output is correct |
77 |
Correct |
18 ms |
1872 KB |
Output is correct |
78 |
Correct |
19 ms |
1884 KB |
Output is correct |
79 |
Correct |
18 ms |
1980 KB |
Output is correct |
80 |
Correct |
18 ms |
1980 KB |
Output is correct |
81 |
Correct |
39 ms |
3668 KB |
Output is correct |
82 |
Correct |
37 ms |
3760 KB |
Output is correct |
83 |
Correct |
37 ms |
3668 KB |
Output is correct |
84 |
Correct |
37 ms |
3736 KB |
Output is correct |
85 |
Correct |
37 ms |
3748 KB |
Output is correct |
86 |
Correct |
41 ms |
3924 KB |
Output is correct |
87 |
Correct |
44 ms |
3788 KB |
Output is correct |
88 |
Correct |
41 ms |
3920 KB |
Output is correct |
89 |
Correct |
41 ms |
3920 KB |
Output is correct |
90 |
Correct |
41 ms |
3860 KB |
Output is correct |
91 |
Correct |
71 ms |
5968 KB |
Output is correct |
92 |
Correct |
72 ms |
5968 KB |
Output is correct |
93 |
Correct |
71 ms |
5972 KB |
Output is correct |
94 |
Correct |
69 ms |
5968 KB |
Output is correct |
95 |
Correct |
69 ms |
5972 KB |
Output is correct |
96 |
Correct |
83 ms |
6488 KB |
Output is correct |
97 |
Correct |
77 ms |
6612 KB |
Output is correct |
98 |
Correct |
76 ms |
6488 KB |
Output is correct |
99 |
Correct |
76 ms |
6476 KB |
Output is correct |
100 |
Correct |
87 ms |
6480 KB |
Output is correct |
101 |
Correct |
76 ms |
6472 KB |
Output is correct |
102 |
Correct |
77 ms |
6480 KB |
Output is correct |
103 |
Correct |
78 ms |
6480 KB |
Output is correct |
104 |
Correct |
76 ms |
6488 KB |
Output is correct |
105 |
Correct |
76 ms |
6488 KB |
Output is correct |
106 |
Correct |
76 ms |
6764 KB |
Output is correct |
107 |
Correct |
77 ms |
6740 KB |
Output is correct |
108 |
Correct |
76 ms |
6740 KB |
Output is correct |
109 |
Correct |
80 ms |
6764 KB |
Output is correct |
110 |
Correct |
76 ms |
6740 KB |
Output is correct |
111 |
Correct |
79 ms |
6768 KB |
Output is correct |
112 |
Correct |
88 ms |
6868 KB |
Output is correct |
113 |
Correct |
76 ms |
6768 KB |
Output is correct |
114 |
Correct |
76 ms |
6736 KB |
Output is correct |
115 |
Correct |
79 ms |
6764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
456 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 |
1704 KB |
Output is correct |
15 |
Correct |
17 ms |
3160 KB |
Output is correct |
16 |
Correct |
27 ms |
4444 KB |
Output is correct |
17 |
Correct |
26 ms |
4548 KB |
Output is correct |
18 |
Correct |
27 ms |
4440 KB |
Output is correct |
19 |
Correct |
27 ms |
4444 KB |
Output is correct |
20 |
Correct |
27 ms |
4444 KB |
Output is correct |
21 |
Correct |
26 ms |
4436 KB |
Output is correct |
22 |
Correct |
28 ms |
4652 KB |
Output is correct |
23 |
Correct |
27 ms |
4432 KB |
Output is correct |
24 |
Correct |
27 ms |
4444 KB |
Output is correct |
25 |
Correct |
26 ms |
4440 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
10 ms |
1884 KB |
Output is correct |
30 |
Correct |
21 ms |
3224 KB |
Output is correct |
31 |
Correct |
30 ms |
4688 KB |
Output is correct |
32 |
Correct |
31 ms |
4692 KB |
Output is correct |
33 |
Correct |
30 ms |
4564 KB |
Output is correct |
34 |
Correct |
31 ms |
4688 KB |
Output is correct |
35 |
Correct |
30 ms |
4940 KB |
Output is correct |
36 |
Correct |
31 ms |
4692 KB |
Output is correct |
37 |
Correct |
30 ms |
4688 KB |
Output is correct |
38 |
Correct |
29 ms |
4436 KB |
Output is correct |
39 |
Correct |
30 ms |
4692 KB |
Output is correct |
40 |
Correct |
31 ms |
4632 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 |
344 KB |
Output is correct |
44 |
Correct |
2 ms |
604 KB |
Output is correct |
45 |
Correct |
2 ms |
604 KB |
Output is correct |
46 |
Correct |
2 ms |
604 KB |
Output is correct |
47 |
Correct |
8 ms |
1056 KB |
Output is correct |
48 |
Correct |
8 ms |
1056 KB |
Output is correct |
49 |
Correct |
15 ms |
1884 KB |
Output is correct |
50 |
Correct |
30 ms |
3412 KB |
Output is correct |
51 |
Correct |
45 ms |
4980 KB |
Output is correct |
52 |
Correct |
44 ms |
4980 KB |
Output is correct |
53 |
Correct |
49 ms |
4960 KB |
Output is correct |
54 |
Correct |
46 ms |
4976 KB |
Output is correct |
55 |
Correct |
45 ms |
4948 KB |
Output is correct |
56 |
Correct |
46 ms |
4944 KB |
Output is correct |
57 |
Correct |
44 ms |
4944 KB |
Output is correct |
58 |
Correct |
44 ms |
4976 KB |
Output is correct |
59 |
Correct |
44 ms |
4948 KB |
Output is correct |
60 |
Correct |
44 ms |
4976 KB |
Output is correct |
61 |
Correct |
44 ms |
4956 KB |
Output is correct |
62 |
Correct |
45 ms |
4948 KB |
Output is correct |
63 |
Correct |
52 ms |
5076 KB |
Output is correct |
64 |
Correct |
45 ms |
4976 KB |
Output is correct |
65 |
Correct |
45 ms |
4960 KB |
Output is correct |
66 |
Correct |
51 ms |
4944 KB |
Output is correct |
67 |
Correct |
45 ms |
4944 KB |
Output is correct |
68 |
Correct |
44 ms |
4944 KB |
Output is correct |
69 |
Correct |
50 ms |
4964 KB |
Output is correct |
70 |
Correct |
44 ms |
4960 KB |
Output is correct |
71 |
Correct |
8 ms |
1140 KB |
Output is correct |
72 |
Correct |
9 ms |
1092 KB |
Output is correct |
73 |
Correct |
9 ms |
1116 KB |
Output is correct |
74 |
Correct |
9 ms |
1116 KB |
Output is correct |
75 |
Correct |
10 ms |
1116 KB |
Output is correct |
76 |
Correct |
19 ms |
1976 KB |
Output is correct |
77 |
Correct |
18 ms |
1872 KB |
Output is correct |
78 |
Correct |
19 ms |
1884 KB |
Output is correct |
79 |
Correct |
18 ms |
1980 KB |
Output is correct |
80 |
Correct |
18 ms |
1980 KB |
Output is correct |
81 |
Correct |
39 ms |
3668 KB |
Output is correct |
82 |
Correct |
37 ms |
3760 KB |
Output is correct |
83 |
Correct |
37 ms |
3668 KB |
Output is correct |
84 |
Correct |
37 ms |
3736 KB |
Output is correct |
85 |
Correct |
37 ms |
3748 KB |
Output is correct |
86 |
Correct |
41 ms |
3924 KB |
Output is correct |
87 |
Correct |
44 ms |
3788 KB |
Output is correct |
88 |
Correct |
41 ms |
3920 KB |
Output is correct |
89 |
Correct |
41 ms |
3920 KB |
Output is correct |
90 |
Correct |
41 ms |
3860 KB |
Output is correct |
91 |
Correct |
71 ms |
5968 KB |
Output is correct |
92 |
Correct |
72 ms |
5968 KB |
Output is correct |
93 |
Correct |
71 ms |
5972 KB |
Output is correct |
94 |
Correct |
69 ms |
5968 KB |
Output is correct |
95 |
Correct |
69 ms |
5972 KB |
Output is correct |
96 |
Correct |
83 ms |
6488 KB |
Output is correct |
97 |
Correct |
77 ms |
6612 KB |
Output is correct |
98 |
Correct |
76 ms |
6488 KB |
Output is correct |
99 |
Correct |
76 ms |
6476 KB |
Output is correct |
100 |
Correct |
87 ms |
6480 KB |
Output is correct |
101 |
Correct |
76 ms |
6472 KB |
Output is correct |
102 |
Correct |
77 ms |
6480 KB |
Output is correct |
103 |
Correct |
78 ms |
6480 KB |
Output is correct |
104 |
Correct |
76 ms |
6488 KB |
Output is correct |
105 |
Correct |
76 ms |
6488 KB |
Output is correct |
106 |
Correct |
76 ms |
6764 KB |
Output is correct |
107 |
Correct |
77 ms |
6740 KB |
Output is correct |
108 |
Correct |
76 ms |
6740 KB |
Output is correct |
109 |
Correct |
80 ms |
6764 KB |
Output is correct |
110 |
Correct |
76 ms |
6740 KB |
Output is correct |
111 |
Correct |
79 ms |
6768 KB |
Output is correct |
112 |
Correct |
88 ms |
6868 KB |
Output is correct |
113 |
Correct |
76 ms |
6768 KB |
Output is correct |
114 |
Correct |
76 ms |
6736 KB |
Output is correct |
115 |
Correct |
79 ms |
6764 KB |
Output is correct |
116 |
Correct |
145 ms |
2508 KB |
Output is correct |
117 |
Correct |
164 ms |
2400 KB |
Output is correct |
118 |
Correct |
202 ms |
3276 KB |
Output is correct |
119 |
Correct |
220 ms |
3328 KB |
Output is correct |
120 |
Correct |
206 ms |
3276 KB |
Output is correct |
121 |
Correct |
279 ms |
4304 KB |
Output is correct |
122 |
Correct |
258 ms |
4264 KB |
Output is correct |
123 |
Correct |
493 ms |
5836 KB |
Output is correct |
124 |
Correct |
364 ms |
6104 KB |
Output is correct |
125 |
Correct |
304 ms |
6092 KB |
Output is correct |
126 |
Correct |
861 ms |
7320 KB |
Output is correct |
127 |
Correct |
826 ms |
7316 KB |
Output is correct |
128 |
Correct |
845 ms |
7304 KB |
Output is correct |
129 |
Correct |
823 ms |
7320 KB |
Output is correct |
130 |
Correct |
810 ms |
7312 KB |
Output is correct |
131 |
Correct |
792 ms |
7356 KB |
Output is correct |
132 |
Correct |
807 ms |
7364 KB |
Output is correct |
133 |
Correct |
819 ms |
7344 KB |
Output is correct |
134 |
Correct |
807 ms |
7352 KB |
Output is correct |
135 |
Correct |
808 ms |
7592 KB |
Output is correct |
136 |
Correct |
798 ms |
7356 KB |
Output is correct |
137 |
Correct |
815 ms |
7376 KB |
Output is correct |
138 |
Correct |
797 ms |
7352 KB |
Output is correct |
139 |
Correct |
813 ms |
7368 KB |
Output is correct |
140 |
Correct |
812 ms |
7352 KB |
Output is correct |
141 |
Correct |
667 ms |
7400 KB |
Output is correct |
142 |
Correct |
699 ms |
7368 KB |
Output is correct |
143 |
Correct |
733 ms |
7372 KB |
Output is correct |
144 |
Correct |
667 ms |
7492 KB |
Output is correct |
145 |
Correct |
738 ms |
7624 KB |
Output is correct |
146 |
Correct |
565 ms |
7676 KB |
Output is correct |
147 |
Correct |
578 ms |
7628 KB |
Output is correct |
148 |
Correct |
526 ms |
7668 KB |
Output is correct |
149 |
Correct |
513 ms |
7684 KB |
Output is correct |
150 |
Correct |
501 ms |
7680 KB |
Output is correct |
151 |
Correct |
596 ms |
7880 KB |
Output is correct |
152 |
Correct |
560 ms |
7884 KB |
Output is correct |
153 |
Correct |
498 ms |
7712 KB |
Output is correct |
154 |
Correct |
515 ms |
7896 KB |
Output is correct |
155 |
Correct |
562 ms |
7716 KB |
Output is correct |
156 |
Correct |
914 ms |
8156 KB |
Output is correct |
157 |
Correct |
915 ms |
8168 KB |
Output is correct |
158 |
Correct |
845 ms |
8408 KB |
Output is correct |
159 |
Correct |
874 ms |
8168 KB |
Output is correct |
160 |
Correct |
869 ms |
8176 KB |
Output is correct |
161 |
Correct |
983 ms |
8176 KB |
Output is correct |
162 |
Correct |
954 ms |
8396 KB |
Output is correct |
163 |
Correct |
1000 ms |
8292 KB |
Output is correct |
164 |
Correct |
929 ms |
8404 KB |
Output is correct |
165 |
Correct |
914 ms |
8392 KB |
Output is correct |
166 |
Correct |
908 ms |
7888 KB |
Output is correct |
167 |
Correct |
844 ms |
7852 KB |
Output is correct |
168 |
Correct |
849 ms |
7852 KB |
Output is correct |
169 |
Correct |
904 ms |
7884 KB |
Output is correct |
170 |
Correct |
875 ms |
7888 KB |
Output is correct |
171 |
Correct |
1004 ms |
7916 KB |
Output is correct |
172 |
Correct |
989 ms |
7920 KB |
Output is correct |
173 |
Correct |
985 ms |
7920 KB |
Output is correct |
174 |
Correct |
997 ms |
8140 KB |
Output is correct |
175 |
Correct |
1014 ms |
7928 KB |
Output is correct |