#include <bits/stdc++.h>
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)
#define rf(i, a, b) for (int i = (a); i >= (b); --i)
#define fe(x, y) for (auto& x : y)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define pw(x) (1LL << (x))
#define sz(x) (int)(x).size()
using namespace std;
//mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
mt19937_64 rng(228);
//#ifdef LOCAL
// #define __int128 ll
//#endif // LOCAL
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order
#define ook order_of_key
template <typename T>
bool umn(T& a, T b) {
return a > b ? a = b, 1 : 0;
}
template <typename T>
bool umx(T& a, T b) {
return a < b ? a = b, 1 : 0;
}
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename T>
using ve = vector<T>;
const int B = 560;
int calc(ve<int> a) {
int ans = 0;
fr (i, 0, sz(a) - 1) {
set<int> s;
fr (j, i, sz(a) - 1) {
s.insert(a[j]);
ans += sz(s);
}
}
return ans;
}
ll calc2(ve<int> a) {
int total = 0;
fe (x, a) total += x;
ll ans = 0;
int toLeft = 0;
ans += 1LL * sz(a) * total * (total + 1) / 2;
fr (i, 0, sz(a) - 1) {
int toRight = total - toLeft - a[i];
ans -= 1LL * toLeft * (toLeft + 1) / 2;
ans -= 1LL * toRight * (toRight + 1) / 2;
toLeft += a[i];
}
return ans;
}
ll calc3Brute(ve<pii> a) {
assert(sz(a) <= 2 * B);
int total = 0;
int gr = 0;
fe (x, a) {
total += x.fi * x.se;
gr += x.se;
}
ll ans = 0;
ans += 1LL * gr * total * (total + 1) / 2;
int toLeft = 0;
fe (cur, a) {
fr (j, 1, cur.se) {
ans -= 1LL * toLeft * (toLeft + 1) / 2;
toLeft += cur.fi;
}
}
reverse(all(a));
toLeft = 0;
fe (cur, a) {
fr (j, 1, cur.se) {
ans -= 1LL * toLeft * (toLeft + 1) / 2;
toLeft += cur.fi;
}
}
return ans;
}
ll calc3(ve<pll> a) {
assert(sz(a) <= 2 * B);
ll total = 0;
ll gr = 0;
fe (x, a) {
total += x.fi * x.se;
gr += x.se;
}
ll ans = 0;
ans += 1LL * gr * total * (total + 1) / 2;
ll toLeft = 0;
fe (cur, a) {
ll res = 0;
res += toLeft * cur.se;
res += cur.fi * 1LL * cur.se * (cur.se - 1) / 2;
res += 1LL * toLeft * toLeft * cur.se;
{
ll t = cur.se * (cur.se - 1) / 2;
t *= 2;
res += t * cur.fi * toLeft;
}
cur.se--;
ll sumSquares = cur.se * (cur.se + 1) * (2 * cur.se + 1) / 6;
cur.se++;
res += sumSquares * cur.fi * cur.fi;
res /= 2;
ans -= res;
toLeft += cur.fi * cur.se;
}
reverse(all(a));
toLeft = 0;
fe (cur, a) {
ll res = 0;
res += toLeft * cur.se;
res += cur.fi * 1LL * cur.se * (cur.se - 1) / 2;
res += 1LL * toLeft * toLeft * cur.se;
{
ll t = cur.se * (cur.se - 1) / 2;
t *= 2;
res += t * cur.fi * toLeft;
}
cur.se--;
ll sumSquares = cur.se * (cur.se + 1) * (2 * cur.se + 1) / 6;
cur.se++;
res += sumSquares * cur.fi * cur.fi;
res /= 2;
ans -= res;
toLeft += cur.fi * cur.se;
}
return ans;
}
const int N = 3e5 + 5;
int n, q;
int a[N];
int cnt[N];
int rnd(int l, int r) {
return rng() % (r - l + 1) + l;
}
ll solve(ve<int> a) {
fe (x, a) cnt[x] = 0;
fe (x, a) cnt[x]++;
ve<pii> order;
fe (x, a) {
if (cnt[x]) {
order.pb({cnt[x], x});
cnt[x] = 0;
}
}
sort(all(order));
reverse(all(order));
{
ve<pii> st;
fe (cur, order) {
if (!sz(st) || cur.fi != st.back().fi) {
st.pb({cur.fi, 1});
} else {
st.back().se++;
}
}
deque<pii> d;
bool who = 0;
fe (x, st) {
if (x.se > 1) {
d.push_front({x.fi, x.se / 2});
d.pb({x.fi, x.se / 2});
x.se %= 2;
}
if (x.se) {
if (who == 0) {
if (sz(d) && d.front().fi == x.fi) d.front().se++;
else d.push_front({x.fi, 1});
} else {
if (sz(d) && d.back().fi == x.fi) d.back().se++;
else d.pb({x.fi, 1});
}
who ^= 1;
}
}
ve<pll> v;
ve<pii> v2;
fe (x, d) {
v.pb(x);
v2.pb(x);
}
// cout << calc3Brute(v2) << "\n";
return calc3(v);
}
assert(0);
}
ve<array<int, 3>> Q;
gp_hash_table<int, bool> have;
int cnt2[N];
ll ans[N];
void add(int x) {
cnt2[cnt[x]]--;
if (cnt2[cnt[x]] == 0) {
have.erase(cnt[x]);
}
cnt[x]++;
cnt2[cnt[x]]++;
if (cnt2[cnt[x]] == 1) {
have[cnt[x]] = 1;
}
}
void del(int x) {
cnt2[cnt[x]]--;
if (cnt2[cnt[x]] == 0) {
have.erase(cnt[x]);
}
cnt[x]--;
cnt2[cnt[x]]++;
if (cnt2[cnt[x]] == 1) {
have[cnt[x]] = 1;
}
}
ll getAns() {
ve<pii> st;
fe (cur, have) {
st.pb({cur.fi, cnt2[cur.fi]});
}
sort(all(st));
reverse(all(st));
deque<pii> d;
bool who = 0;
fe (x, st) {
if (x.se > 1) {
d.push_front({x.fi, x.se / 2});
d.pb({x.fi, x.se / 2});
x.se %= 2;
}
if (x.se) {
if (who == 0) {
if (sz(d) && d.front().fi == x.fi) d.front().se++;
else d.push_front({x.fi, 1});
} else {
if (sz(d) && d.back().fi == x.fi) d.back().se++;
else d.pb({x.fi, 1});
}
who ^= 1;
}
}
ve<pll> v;
fe (x, d) {
v.pb(x);
}
return calc3(v);
}
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
ios::sync_with_stdio(0);
cin.tie(0);
#endif
cin >> n >> q;
fr (i, 1, n) {
cin >> a[i];
}
fr (i, 1, q) {
int l, r;
cin >> l >> r;
Q.pb({l, r, i});
}
sort(all(Q), [](array<int, 3> a, array<int, 3> b) {
if (a[0] / B != b[0] / B) {
return a[0] / B < b[0] / B;
}
return a[1] < b[1];
});
int L = 1;
int R = 0;
fe (cur, Q) {
while (R < cur[1]) add(a[++R]);
while (L > cur[0]) add(a[--L]);
while (R > cur[1]) del(a[R--]);
while (L < cur[0]) del(a[L++]);
ans[cur[2]] = getAns();
}
fr (i, 1, q) {
cout << ans[i] << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
244 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
21 ms |
796 KB |
Output is correct |
5 |
Correct |
44 ms |
1384 KB |
Output is correct |
6 |
Correct |
67 ms |
1700 KB |
Output is correct |
7 |
Correct |
70 ms |
2104 KB |
Output is correct |
8 |
Correct |
64 ms |
1644 KB |
Output is correct |
9 |
Correct |
73 ms |
1744 KB |
Output is correct |
10 |
Correct |
64 ms |
1844 KB |
Output is correct |
11 |
Correct |
67 ms |
1696 KB |
Output is correct |
12 |
Correct |
66 ms |
1612 KB |
Output is correct |
13 |
Correct |
63 ms |
1632 KB |
Output is correct |
14 |
Correct |
73 ms |
1696 KB |
Output is correct |
15 |
Correct |
64 ms |
1764 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
244 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
21 ms |
796 KB |
Output is correct |
5 |
Correct |
44 ms |
1384 KB |
Output is correct |
6 |
Correct |
67 ms |
1700 KB |
Output is correct |
7 |
Correct |
70 ms |
2104 KB |
Output is correct |
8 |
Correct |
64 ms |
1644 KB |
Output is correct |
9 |
Correct |
73 ms |
1744 KB |
Output is correct |
10 |
Correct |
64 ms |
1844 KB |
Output is correct |
11 |
Correct |
67 ms |
1696 KB |
Output is correct |
12 |
Correct |
66 ms |
1612 KB |
Output is correct |
13 |
Correct |
63 ms |
1632 KB |
Output is correct |
14 |
Correct |
73 ms |
1696 KB |
Output is correct |
15 |
Correct |
64 ms |
1764 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
5 ms |
340 KB |
Output is correct |
19 |
Correct |
34 ms |
748 KB |
Output is correct |
20 |
Correct |
72 ms |
1144 KB |
Output is correct |
21 |
Correct |
110 ms |
1680 KB |
Output is correct |
22 |
Correct |
99 ms |
1564 KB |
Output is correct |
23 |
Correct |
96 ms |
1692 KB |
Output is correct |
24 |
Correct |
98 ms |
1644 KB |
Output is correct |
25 |
Correct |
101 ms |
1656 KB |
Output is correct |
26 |
Correct |
97 ms |
1532 KB |
Output is correct |
27 |
Correct |
118 ms |
1632 KB |
Output is correct |
28 |
Correct |
97 ms |
1800 KB |
Output is correct |
29 |
Correct |
107 ms |
1656 KB |
Output is correct |
30 |
Correct |
119 ms |
1692 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
244 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
21 ms |
796 KB |
Output is correct |
5 |
Correct |
44 ms |
1384 KB |
Output is correct |
6 |
Correct |
67 ms |
1700 KB |
Output is correct |
7 |
Correct |
70 ms |
2104 KB |
Output is correct |
8 |
Correct |
64 ms |
1644 KB |
Output is correct |
9 |
Correct |
73 ms |
1744 KB |
Output is correct |
10 |
Correct |
64 ms |
1844 KB |
Output is correct |
11 |
Correct |
67 ms |
1696 KB |
Output is correct |
12 |
Correct |
66 ms |
1612 KB |
Output is correct |
13 |
Correct |
63 ms |
1632 KB |
Output is correct |
14 |
Correct |
73 ms |
1696 KB |
Output is correct |
15 |
Correct |
64 ms |
1764 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
5 ms |
340 KB |
Output is correct |
19 |
Correct |
34 ms |
748 KB |
Output is correct |
20 |
Correct |
72 ms |
1144 KB |
Output is correct |
21 |
Correct |
110 ms |
1680 KB |
Output is correct |
22 |
Correct |
99 ms |
1564 KB |
Output is correct |
23 |
Correct |
96 ms |
1692 KB |
Output is correct |
24 |
Correct |
98 ms |
1644 KB |
Output is correct |
25 |
Correct |
101 ms |
1656 KB |
Output is correct |
26 |
Correct |
97 ms |
1532 KB |
Output is correct |
27 |
Correct |
118 ms |
1632 KB |
Output is correct |
28 |
Correct |
97 ms |
1800 KB |
Output is correct |
29 |
Correct |
107 ms |
1656 KB |
Output is correct |
30 |
Correct |
119 ms |
1692 KB |
Output is correct |
31 |
Correct |
0 ms |
352 KB |
Output is correct |
32 |
Correct |
1 ms |
352 KB |
Output is correct |
33 |
Correct |
1 ms |
352 KB |
Output is correct |
34 |
Correct |
6 ms |
352 KB |
Output is correct |
35 |
Correct |
2 ms |
352 KB |
Output is correct |
36 |
Correct |
1 ms |
352 KB |
Output is correct |
37 |
Correct |
19 ms |
560 KB |
Output is correct |
38 |
Correct |
6 ms |
560 KB |
Output is correct |
39 |
Correct |
22 ms |
760 KB |
Output is correct |
40 |
Correct |
120 ms |
1140 KB |
Output is correct |
41 |
Correct |
244 ms |
1528 KB |
Output is correct |
42 |
Correct |
253 ms |
1524 KB |
Output is correct |
43 |
Correct |
276 ms |
1528 KB |
Output is correct |
44 |
Correct |
257 ms |
1556 KB |
Output is correct |
45 |
Correct |
378 ms |
1500 KB |
Output is correct |
46 |
Correct |
238 ms |
1556 KB |
Output is correct |
47 |
Correct |
199 ms |
1520 KB |
Output is correct |
48 |
Correct |
245 ms |
1556 KB |
Output is correct |
49 |
Correct |
219 ms |
1492 KB |
Output is correct |
50 |
Correct |
215 ms |
1520 KB |
Output is correct |
51 |
Correct |
236 ms |
1492 KB |
Output is correct |
52 |
Correct |
232 ms |
1784 KB |
Output is correct |
53 |
Correct |
217 ms |
1556 KB |
Output is correct |
54 |
Correct |
232 ms |
1528 KB |
Output is correct |
55 |
Correct |
205 ms |
1540 KB |
Output is correct |
56 |
Correct |
219 ms |
1544 KB |
Output is correct |
57 |
Correct |
218 ms |
1560 KB |
Output is correct |
58 |
Correct |
237 ms |
1524 KB |
Output is correct |
59 |
Correct |
240 ms |
1528 KB |
Output is correct |
60 |
Correct |
225 ms |
1492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
244 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
21 ms |
796 KB |
Output is correct |
15 |
Correct |
44 ms |
1384 KB |
Output is correct |
16 |
Correct |
67 ms |
1700 KB |
Output is correct |
17 |
Correct |
70 ms |
2104 KB |
Output is correct |
18 |
Correct |
64 ms |
1644 KB |
Output is correct |
19 |
Correct |
73 ms |
1744 KB |
Output is correct |
20 |
Correct |
64 ms |
1844 KB |
Output is correct |
21 |
Correct |
67 ms |
1696 KB |
Output is correct |
22 |
Correct |
66 ms |
1612 KB |
Output is correct |
23 |
Correct |
63 ms |
1632 KB |
Output is correct |
24 |
Correct |
73 ms |
1696 KB |
Output is correct |
25 |
Correct |
64 ms |
1764 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
5 ms |
340 KB |
Output is correct |
29 |
Correct |
34 ms |
748 KB |
Output is correct |
30 |
Correct |
72 ms |
1144 KB |
Output is correct |
31 |
Correct |
110 ms |
1680 KB |
Output is correct |
32 |
Correct |
99 ms |
1564 KB |
Output is correct |
33 |
Correct |
96 ms |
1692 KB |
Output is correct |
34 |
Correct |
98 ms |
1644 KB |
Output is correct |
35 |
Correct |
101 ms |
1656 KB |
Output is correct |
36 |
Correct |
97 ms |
1532 KB |
Output is correct |
37 |
Correct |
118 ms |
1632 KB |
Output is correct |
38 |
Correct |
97 ms |
1800 KB |
Output is correct |
39 |
Correct |
107 ms |
1656 KB |
Output is correct |
40 |
Correct |
119 ms |
1692 KB |
Output is correct |
41 |
Correct |
0 ms |
352 KB |
Output is correct |
42 |
Correct |
1 ms |
352 KB |
Output is correct |
43 |
Correct |
1 ms |
352 KB |
Output is correct |
44 |
Correct |
6 ms |
352 KB |
Output is correct |
45 |
Correct |
2 ms |
352 KB |
Output is correct |
46 |
Correct |
1 ms |
352 KB |
Output is correct |
47 |
Correct |
19 ms |
560 KB |
Output is correct |
48 |
Correct |
6 ms |
560 KB |
Output is correct |
49 |
Correct |
22 ms |
760 KB |
Output is correct |
50 |
Correct |
120 ms |
1140 KB |
Output is correct |
51 |
Correct |
244 ms |
1528 KB |
Output is correct |
52 |
Correct |
253 ms |
1524 KB |
Output is correct |
53 |
Correct |
276 ms |
1528 KB |
Output is correct |
54 |
Correct |
257 ms |
1556 KB |
Output is correct |
55 |
Correct |
378 ms |
1500 KB |
Output is correct |
56 |
Correct |
238 ms |
1556 KB |
Output is correct |
57 |
Correct |
199 ms |
1520 KB |
Output is correct |
58 |
Correct |
245 ms |
1556 KB |
Output is correct |
59 |
Correct |
219 ms |
1492 KB |
Output is correct |
60 |
Correct |
215 ms |
1520 KB |
Output is correct |
61 |
Correct |
236 ms |
1492 KB |
Output is correct |
62 |
Correct |
232 ms |
1784 KB |
Output is correct |
63 |
Correct |
217 ms |
1556 KB |
Output is correct |
64 |
Correct |
232 ms |
1528 KB |
Output is correct |
65 |
Correct |
205 ms |
1540 KB |
Output is correct |
66 |
Correct |
219 ms |
1544 KB |
Output is correct |
67 |
Correct |
218 ms |
1560 KB |
Output is correct |
68 |
Correct |
237 ms |
1524 KB |
Output is correct |
69 |
Correct |
240 ms |
1528 KB |
Output is correct |
70 |
Correct |
225 ms |
1492 KB |
Output is correct |
71 |
Correct |
4 ms |
468 KB |
Output is correct |
72 |
Correct |
4 ms |
468 KB |
Output is correct |
73 |
Correct |
5 ms |
468 KB |
Output is correct |
74 |
Correct |
6 ms |
468 KB |
Output is correct |
75 |
Correct |
4 ms |
468 KB |
Output is correct |
76 |
Correct |
12 ms |
724 KB |
Output is correct |
77 |
Correct |
7 ms |
724 KB |
Output is correct |
78 |
Correct |
7 ms |
724 KB |
Output is correct |
79 |
Correct |
8 ms |
780 KB |
Output is correct |
80 |
Correct |
8 ms |
724 KB |
Output is correct |
81 |
Correct |
14 ms |
1176 KB |
Output is correct |
82 |
Correct |
16 ms |
1108 KB |
Output is correct |
83 |
Correct |
14 ms |
1088 KB |
Output is correct |
84 |
Correct |
15 ms |
1120 KB |
Output is correct |
85 |
Correct |
14 ms |
1108 KB |
Output is correct |
86 |
Correct |
17 ms |
1208 KB |
Output is correct |
87 |
Correct |
20 ms |
1108 KB |
Output is correct |
88 |
Correct |
15 ms |
1108 KB |
Output is correct |
89 |
Correct |
16 ms |
1136 KB |
Output is correct |
90 |
Correct |
22 ms |
1204 KB |
Output is correct |
91 |
Correct |
24 ms |
1812 KB |
Output is correct |
92 |
Correct |
24 ms |
1876 KB |
Output is correct |
93 |
Correct |
32 ms |
1780 KB |
Output is correct |
94 |
Correct |
23 ms |
1828 KB |
Output is correct |
95 |
Correct |
31 ms |
1860 KB |
Output is correct |
96 |
Correct |
37 ms |
2252 KB |
Output is correct |
97 |
Correct |
35 ms |
2224 KB |
Output is correct |
98 |
Correct |
34 ms |
2516 KB |
Output is correct |
99 |
Correct |
32 ms |
2504 KB |
Output is correct |
100 |
Correct |
29 ms |
2532 KB |
Output is correct |
101 |
Correct |
31 ms |
2480 KB |
Output is correct |
102 |
Correct |
41 ms |
2772 KB |
Output is correct |
103 |
Correct |
39 ms |
2868 KB |
Output is correct |
104 |
Correct |
34 ms |
2972 KB |
Output is correct |
105 |
Correct |
33 ms |
3032 KB |
Output is correct |
106 |
Correct |
44 ms |
3284 KB |
Output is correct |
107 |
Correct |
33 ms |
3612 KB |
Output is correct |
108 |
Correct |
36 ms |
3756 KB |
Output is correct |
109 |
Correct |
35 ms |
3860 KB |
Output is correct |
110 |
Correct |
35 ms |
3892 KB |
Output is correct |
111 |
Correct |
35 ms |
4348 KB |
Output is correct |
112 |
Correct |
33 ms |
4392 KB |
Output is correct |
113 |
Correct |
33 ms |
4368 KB |
Output is correct |
114 |
Correct |
36 ms |
4296 KB |
Output is correct |
115 |
Correct |
39 ms |
4376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
244 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
21 ms |
796 KB |
Output is correct |
15 |
Correct |
44 ms |
1384 KB |
Output is correct |
16 |
Correct |
67 ms |
1700 KB |
Output is correct |
17 |
Correct |
70 ms |
2104 KB |
Output is correct |
18 |
Correct |
64 ms |
1644 KB |
Output is correct |
19 |
Correct |
73 ms |
1744 KB |
Output is correct |
20 |
Correct |
64 ms |
1844 KB |
Output is correct |
21 |
Correct |
67 ms |
1696 KB |
Output is correct |
22 |
Correct |
66 ms |
1612 KB |
Output is correct |
23 |
Correct |
63 ms |
1632 KB |
Output is correct |
24 |
Correct |
73 ms |
1696 KB |
Output is correct |
25 |
Correct |
64 ms |
1764 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
5 ms |
340 KB |
Output is correct |
29 |
Correct |
34 ms |
748 KB |
Output is correct |
30 |
Correct |
72 ms |
1144 KB |
Output is correct |
31 |
Correct |
110 ms |
1680 KB |
Output is correct |
32 |
Correct |
99 ms |
1564 KB |
Output is correct |
33 |
Correct |
96 ms |
1692 KB |
Output is correct |
34 |
Correct |
98 ms |
1644 KB |
Output is correct |
35 |
Correct |
101 ms |
1656 KB |
Output is correct |
36 |
Correct |
97 ms |
1532 KB |
Output is correct |
37 |
Correct |
118 ms |
1632 KB |
Output is correct |
38 |
Correct |
97 ms |
1800 KB |
Output is correct |
39 |
Correct |
107 ms |
1656 KB |
Output is correct |
40 |
Correct |
119 ms |
1692 KB |
Output is correct |
41 |
Correct |
0 ms |
352 KB |
Output is correct |
42 |
Correct |
1 ms |
352 KB |
Output is correct |
43 |
Correct |
1 ms |
352 KB |
Output is correct |
44 |
Correct |
6 ms |
352 KB |
Output is correct |
45 |
Correct |
2 ms |
352 KB |
Output is correct |
46 |
Correct |
1 ms |
352 KB |
Output is correct |
47 |
Correct |
19 ms |
560 KB |
Output is correct |
48 |
Correct |
6 ms |
560 KB |
Output is correct |
49 |
Correct |
22 ms |
760 KB |
Output is correct |
50 |
Correct |
120 ms |
1140 KB |
Output is correct |
51 |
Correct |
244 ms |
1528 KB |
Output is correct |
52 |
Correct |
253 ms |
1524 KB |
Output is correct |
53 |
Correct |
276 ms |
1528 KB |
Output is correct |
54 |
Correct |
257 ms |
1556 KB |
Output is correct |
55 |
Correct |
378 ms |
1500 KB |
Output is correct |
56 |
Correct |
238 ms |
1556 KB |
Output is correct |
57 |
Correct |
199 ms |
1520 KB |
Output is correct |
58 |
Correct |
245 ms |
1556 KB |
Output is correct |
59 |
Correct |
219 ms |
1492 KB |
Output is correct |
60 |
Correct |
215 ms |
1520 KB |
Output is correct |
61 |
Correct |
236 ms |
1492 KB |
Output is correct |
62 |
Correct |
232 ms |
1784 KB |
Output is correct |
63 |
Correct |
217 ms |
1556 KB |
Output is correct |
64 |
Correct |
232 ms |
1528 KB |
Output is correct |
65 |
Correct |
205 ms |
1540 KB |
Output is correct |
66 |
Correct |
219 ms |
1544 KB |
Output is correct |
67 |
Correct |
218 ms |
1560 KB |
Output is correct |
68 |
Correct |
237 ms |
1524 KB |
Output is correct |
69 |
Correct |
240 ms |
1528 KB |
Output is correct |
70 |
Correct |
225 ms |
1492 KB |
Output is correct |
71 |
Correct |
4 ms |
468 KB |
Output is correct |
72 |
Correct |
4 ms |
468 KB |
Output is correct |
73 |
Correct |
5 ms |
468 KB |
Output is correct |
74 |
Correct |
6 ms |
468 KB |
Output is correct |
75 |
Correct |
4 ms |
468 KB |
Output is correct |
76 |
Correct |
12 ms |
724 KB |
Output is correct |
77 |
Correct |
7 ms |
724 KB |
Output is correct |
78 |
Correct |
7 ms |
724 KB |
Output is correct |
79 |
Correct |
8 ms |
780 KB |
Output is correct |
80 |
Correct |
8 ms |
724 KB |
Output is correct |
81 |
Correct |
14 ms |
1176 KB |
Output is correct |
82 |
Correct |
16 ms |
1108 KB |
Output is correct |
83 |
Correct |
14 ms |
1088 KB |
Output is correct |
84 |
Correct |
15 ms |
1120 KB |
Output is correct |
85 |
Correct |
14 ms |
1108 KB |
Output is correct |
86 |
Correct |
17 ms |
1208 KB |
Output is correct |
87 |
Correct |
20 ms |
1108 KB |
Output is correct |
88 |
Correct |
15 ms |
1108 KB |
Output is correct |
89 |
Correct |
16 ms |
1136 KB |
Output is correct |
90 |
Correct |
22 ms |
1204 KB |
Output is correct |
91 |
Correct |
24 ms |
1812 KB |
Output is correct |
92 |
Correct |
24 ms |
1876 KB |
Output is correct |
93 |
Correct |
32 ms |
1780 KB |
Output is correct |
94 |
Correct |
23 ms |
1828 KB |
Output is correct |
95 |
Correct |
31 ms |
1860 KB |
Output is correct |
96 |
Correct |
37 ms |
2252 KB |
Output is correct |
97 |
Correct |
35 ms |
2224 KB |
Output is correct |
98 |
Correct |
34 ms |
2516 KB |
Output is correct |
99 |
Correct |
32 ms |
2504 KB |
Output is correct |
100 |
Correct |
29 ms |
2532 KB |
Output is correct |
101 |
Correct |
31 ms |
2480 KB |
Output is correct |
102 |
Correct |
41 ms |
2772 KB |
Output is correct |
103 |
Correct |
39 ms |
2868 KB |
Output is correct |
104 |
Correct |
34 ms |
2972 KB |
Output is correct |
105 |
Correct |
33 ms |
3032 KB |
Output is correct |
106 |
Correct |
44 ms |
3284 KB |
Output is correct |
107 |
Correct |
33 ms |
3612 KB |
Output is correct |
108 |
Correct |
36 ms |
3756 KB |
Output is correct |
109 |
Correct |
35 ms |
3860 KB |
Output is correct |
110 |
Correct |
35 ms |
3892 KB |
Output is correct |
111 |
Correct |
35 ms |
4348 KB |
Output is correct |
112 |
Correct |
33 ms |
4392 KB |
Output is correct |
113 |
Correct |
33 ms |
4368 KB |
Output is correct |
114 |
Correct |
36 ms |
4296 KB |
Output is correct |
115 |
Correct |
39 ms |
4376 KB |
Output is correct |
116 |
Correct |
3200 ms |
2388 KB |
Output is correct |
117 |
Correct |
2144 ms |
2508 KB |
Output is correct |
118 |
Execution timed out |
7052 ms |
2468 KB |
Time limit exceeded |
119 |
Halted |
0 ms |
0 KB |
- |