/**
____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|
**/
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
const int maxn = 3e5 + 10, maxq = 5e4 + 10;
const int block_size = sqrt(maxn);
struct query
{
int l, r, idx;
} task[maxq];
bool cmp_mo(query t1, query t2)
{
if (t1.l / block_size == t2.l / block_size)
return t1.r < t2.r;
return t1.l < t2.l;
}
int q, a[maxn], freq[maxn], comp[maxn];
ll n;
unordered_map < int, int > act;
void update(int val, int c)
{
///cout << "update " << val << " " << c << endl;
if (freq[val] != 0)
{
act[freq[val]] --;
if (act[freq[val]] == 0)
act.erase(freq[val]);
}
///comp[freq[val]] --;
freq[val] += c;
///comp[freq[val]] ++;
if (freq[val] != 0)
{
act[freq[val]] ++;
}
}
int lf = 1, rf = 0;
ll ans[maxn];
void move_borders(int left, int right)
{
while(rf < right)
{
rf ++;
update(a[rf], 1);
}
while(lf > left)
{
lf --;
update(a[lf], 1);
}
while(rf > right)
{
update(a[rf], -1);
rf --;
}
while(lf < left)
{
update(a[lf], -1);
lf ++;
}
}
ll arr[maxn], bef[maxn], aft[maxn], prec[maxn];
ll calc_function(ll len)
{
vector < pair < ll, ll > > values;
for (pair < int, int > cur : act)
{
values.push_back(cur);
}
sort(values.begin(), values.end());
ll sz = values.size(), cp = 0;
deque < pair < ll, ll > > dq;
ll left_add = 0, right_add = 0;
values.back().second --;
cp ++;
dq.push_back({values.back().first, 1});
for (int i = sz - 1; i >= 0; i --)
{
///cout << "here " << i << " " << values[i].first << " " << values[i].second << endl;
ll p1 = (values[i].second + 1) / 2;
ll p2 = (values[i].second) / 2;
if (right_add > left_add)
swap(p1, p2);
if(p1 != 0)
dq.push_back({values[i].first, p1});
if (p2 != 0)
dq.push_front({values[i].first, p2});
cp += values[i].second;
left_add += p2;
right_add += p1;
}
/**int pt = 0;
for (int i = 0; i < dq.size(); i ++)
{
for (int j = 0; j < dq[i].second; j ++)
arr[++ pt] = dq[i].first;
}*/
ll tot = 0, pref = 0;
/**for (int i = 1; i < cp; i ++)
{
pref += arr[i];
tot = tot + pref * pref;
}*/
///cout << "-----------" << endl;
for (int i = 0; i < dq.size(); i ++)
{
ll l = dq[i].second;
tot = tot + l * pref * pref;
tot = tot + l * (l + 1) * pref * dq[i].first;
tot = tot + prec[l] * dq[i].first * dq[i].first;
pref = pref + dq[i].first * l;
///cout << pref << " " << tot << " " << dq[i].first << " " << dq[i].second << endl;
}
tot = tot - pref * pref;
ll suff = 0;
for (int i = dq.size() - 1; i >= 0; i --)
{
ll l = dq[i].second;
tot = tot + l * suff * suff;
tot = tot + l * (l + 1) * suff * dq[i].first;
tot = tot + prec[l] * dq[i].first * dq[i].first;
suff = suff + dq[i].first * l;
}
tot = tot - suff * suff;
/**for (int i = cp; i > 1; i --)
{
suff = suff + arr[i];
tot = tot + suff * suff;
}*/
///cout << tot << endl;
tot = (cp * len * (len + 1) - len * (cp - 1) - tot) / 2;
return tot;
}
void compress_data()
{
int cur = 0;
map < int, int > mp;
for (int i = 1; i <= n; i ++)
{
if (mp[a[i]] == 0)
mp[a[i]] = ++ cur;
a[i] = mp[a[i]];
}
}
void solve()
{
cin >> n >> q;
for (int i = 1; i <= n; i ++)
cin >> a[i];
for (int i = 1; i <= n; i ++)
{
prec[i] = prec[i - 1] + (ll)(i) * (ll)(i);
}
compress_data();
for (int i = 1; i <= q; i ++)
{
cin >> task[i].l >> task[i].r;
task[i].idx = i;
}
sort(task + 1, task + q + 1, cmp_mo);
for (int i = 1; i <= q; i ++)
{
move_borders(task[i].l, task[i].r);
ans[task[i].idx] = calc_function(task[i].r - task[i].l + 1);
}
for (int i = 1; i <= q; i ++)
cout << ans[i] << endl;
}
int main()
{
speed();
solve();
return 0;
}
Compilation message
diversity.cpp: In function 'll calc_function(ll)':
diversity.cpp:137:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
137 | for (int i = 0; i < dq.size(); i ++)
| ~~^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
1 ms |
6488 KB |
Output is correct |
8 |
Correct |
1 ms |
6492 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
1 ms |
6492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
14 ms |
9028 KB |
Output is correct |
5 |
Correct |
26 ms |
9552 KB |
Output is correct |
6 |
Correct |
42 ms |
12108 KB |
Output is correct |
7 |
Correct |
44 ms |
12208 KB |
Output is correct |
8 |
Correct |
41 ms |
12220 KB |
Output is correct |
9 |
Correct |
42 ms |
11984 KB |
Output is correct |
10 |
Correct |
41 ms |
12016 KB |
Output is correct |
11 |
Correct |
42 ms |
12112 KB |
Output is correct |
12 |
Correct |
41 ms |
12124 KB |
Output is correct |
13 |
Correct |
42 ms |
12116 KB |
Output is correct |
14 |
Correct |
42 ms |
12244 KB |
Output is correct |
15 |
Correct |
41 ms |
12116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
14 ms |
9028 KB |
Output is correct |
5 |
Correct |
26 ms |
9552 KB |
Output is correct |
6 |
Correct |
42 ms |
12108 KB |
Output is correct |
7 |
Correct |
44 ms |
12208 KB |
Output is correct |
8 |
Correct |
41 ms |
12220 KB |
Output is correct |
9 |
Correct |
42 ms |
11984 KB |
Output is correct |
10 |
Correct |
41 ms |
12016 KB |
Output is correct |
11 |
Correct |
42 ms |
12112 KB |
Output is correct |
12 |
Correct |
41 ms |
12124 KB |
Output is correct |
13 |
Correct |
42 ms |
12116 KB |
Output is correct |
14 |
Correct |
42 ms |
12244 KB |
Output is correct |
15 |
Correct |
41 ms |
12116 KB |
Output is correct |
16 |
Correct |
1 ms |
6492 KB |
Output is correct |
17 |
Correct |
1 ms |
6492 KB |
Output is correct |
18 |
Correct |
2 ms |
6492 KB |
Output is correct |
19 |
Correct |
15 ms |
9052 KB |
Output is correct |
20 |
Correct |
28 ms |
9564 KB |
Output is correct |
21 |
Correct |
43 ms |
12372 KB |
Output is correct |
22 |
Correct |
46 ms |
12372 KB |
Output is correct |
23 |
Correct |
43 ms |
12368 KB |
Output is correct |
24 |
Correct |
44 ms |
12372 KB |
Output is correct |
25 |
Correct |
43 ms |
12136 KB |
Output is correct |
26 |
Correct |
44 ms |
12120 KB |
Output is correct |
27 |
Correct |
44 ms |
12380 KB |
Output is correct |
28 |
Correct |
45 ms |
12324 KB |
Output is correct |
29 |
Correct |
43 ms |
12116 KB |
Output is correct |
30 |
Correct |
43 ms |
12300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6492 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
2 ms |
6492 KB |
Output is correct |
4 |
Correct |
14 ms |
9028 KB |
Output is correct |
5 |
Correct |
26 ms |
9552 KB |
Output is correct |
6 |
Correct |
42 ms |
12108 KB |
Output is correct |
7 |
Correct |
44 ms |
12208 KB |
Output is correct |
8 |
Correct |
41 ms |
12220 KB |
Output is correct |
9 |
Correct |
42 ms |
11984 KB |
Output is correct |
10 |
Correct |
41 ms |
12016 KB |
Output is correct |
11 |
Correct |
42 ms |
12112 KB |
Output is correct |
12 |
Correct |
41 ms |
12124 KB |
Output is correct |
13 |
Correct |
42 ms |
12116 KB |
Output is correct |
14 |
Correct |
42 ms |
12244 KB |
Output is correct |
15 |
Correct |
41 ms |
12116 KB |
Output is correct |
16 |
Correct |
1 ms |
6492 KB |
Output is correct |
17 |
Correct |
1 ms |
6492 KB |
Output is correct |
18 |
Correct |
2 ms |
6492 KB |
Output is correct |
19 |
Correct |
15 ms |
9052 KB |
Output is correct |
20 |
Correct |
28 ms |
9564 KB |
Output is correct |
21 |
Correct |
43 ms |
12372 KB |
Output is correct |
22 |
Correct |
46 ms |
12372 KB |
Output is correct |
23 |
Correct |
43 ms |
12368 KB |
Output is correct |
24 |
Correct |
44 ms |
12372 KB |
Output is correct |
25 |
Correct |
43 ms |
12136 KB |
Output is correct |
26 |
Correct |
44 ms |
12120 KB |
Output is correct |
27 |
Correct |
44 ms |
12380 KB |
Output is correct |
28 |
Correct |
45 ms |
12324 KB |
Output is correct |
29 |
Correct |
43 ms |
12116 KB |
Output is correct |
30 |
Correct |
43 ms |
12300 KB |
Output is correct |
31 |
Correct |
1 ms |
6492 KB |
Output is correct |
32 |
Correct |
1 ms |
6492 KB |
Output is correct |
33 |
Correct |
1 ms |
6492 KB |
Output is correct |
34 |
Correct |
3 ms |
6620 KB |
Output is correct |
35 |
Correct |
2 ms |
6748 KB |
Output is correct |
36 |
Correct |
3 ms |
6748 KB |
Output is correct |
37 |
Correct |
9 ms |
9048 KB |
Output is correct |
38 |
Correct |
10 ms |
9052 KB |
Output is correct |
39 |
Correct |
18 ms |
9052 KB |
Output is correct |
40 |
Correct |
36 ms |
9872 KB |
Output is correct |
41 |
Correct |
54 ms |
12628 KB |
Output is correct |
42 |
Correct |
52 ms |
12796 KB |
Output is correct |
43 |
Correct |
52 ms |
12624 KB |
Output is correct |
44 |
Correct |
53 ms |
12808 KB |
Output is correct |
45 |
Correct |
54 ms |
12788 KB |
Output is correct |
46 |
Correct |
53 ms |
12792 KB |
Output is correct |
47 |
Correct |
53 ms |
12804 KB |
Output is correct |
48 |
Correct |
54 ms |
12628 KB |
Output is correct |
49 |
Correct |
53 ms |
12628 KB |
Output is correct |
50 |
Correct |
54 ms |
12784 KB |
Output is correct |
51 |
Correct |
52 ms |
12624 KB |
Output is correct |
52 |
Correct |
52 ms |
12624 KB |
Output is correct |
53 |
Correct |
53 ms |
12624 KB |
Output is correct |
54 |
Correct |
53 ms |
12800 KB |
Output is correct |
55 |
Correct |
53 ms |
12744 KB |
Output is correct |
56 |
Correct |
53 ms |
12628 KB |
Output is correct |
57 |
Correct |
53 ms |
12628 KB |
Output is correct |
58 |
Correct |
53 ms |
12624 KB |
Output is correct |
59 |
Correct |
52 ms |
12792 KB |
Output is correct |
60 |
Correct |
53 ms |
12804 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
1 ms |
6488 KB |
Output is correct |
8 |
Correct |
1 ms |
6492 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
1 ms |
6492 KB |
Output is correct |
11 |
Correct |
1 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
6492 KB |
Output is correct |
13 |
Correct |
2 ms |
6492 KB |
Output is correct |
14 |
Correct |
14 ms |
9028 KB |
Output is correct |
15 |
Correct |
26 ms |
9552 KB |
Output is correct |
16 |
Correct |
42 ms |
12108 KB |
Output is correct |
17 |
Correct |
44 ms |
12208 KB |
Output is correct |
18 |
Correct |
41 ms |
12220 KB |
Output is correct |
19 |
Correct |
42 ms |
11984 KB |
Output is correct |
20 |
Correct |
41 ms |
12016 KB |
Output is correct |
21 |
Correct |
42 ms |
12112 KB |
Output is correct |
22 |
Correct |
41 ms |
12124 KB |
Output is correct |
23 |
Correct |
42 ms |
12116 KB |
Output is correct |
24 |
Correct |
42 ms |
12244 KB |
Output is correct |
25 |
Correct |
41 ms |
12116 KB |
Output is correct |
26 |
Correct |
1 ms |
6492 KB |
Output is correct |
27 |
Correct |
1 ms |
6492 KB |
Output is correct |
28 |
Correct |
2 ms |
6492 KB |
Output is correct |
29 |
Correct |
15 ms |
9052 KB |
Output is correct |
30 |
Correct |
28 ms |
9564 KB |
Output is correct |
31 |
Correct |
43 ms |
12372 KB |
Output is correct |
32 |
Correct |
46 ms |
12372 KB |
Output is correct |
33 |
Correct |
43 ms |
12368 KB |
Output is correct |
34 |
Correct |
44 ms |
12372 KB |
Output is correct |
35 |
Correct |
43 ms |
12136 KB |
Output is correct |
36 |
Correct |
44 ms |
12120 KB |
Output is correct |
37 |
Correct |
44 ms |
12380 KB |
Output is correct |
38 |
Correct |
45 ms |
12324 KB |
Output is correct |
39 |
Correct |
43 ms |
12116 KB |
Output is correct |
40 |
Correct |
43 ms |
12300 KB |
Output is correct |
41 |
Correct |
1 ms |
6492 KB |
Output is correct |
42 |
Correct |
1 ms |
6492 KB |
Output is correct |
43 |
Correct |
1 ms |
6492 KB |
Output is correct |
44 |
Correct |
3 ms |
6620 KB |
Output is correct |
45 |
Correct |
2 ms |
6748 KB |
Output is correct |
46 |
Correct |
3 ms |
6748 KB |
Output is correct |
47 |
Correct |
9 ms |
9048 KB |
Output is correct |
48 |
Correct |
10 ms |
9052 KB |
Output is correct |
49 |
Correct |
18 ms |
9052 KB |
Output is correct |
50 |
Correct |
36 ms |
9872 KB |
Output is correct |
51 |
Correct |
54 ms |
12628 KB |
Output is correct |
52 |
Correct |
52 ms |
12796 KB |
Output is correct |
53 |
Correct |
52 ms |
12624 KB |
Output is correct |
54 |
Correct |
53 ms |
12808 KB |
Output is correct |
55 |
Correct |
54 ms |
12788 KB |
Output is correct |
56 |
Correct |
53 ms |
12792 KB |
Output is correct |
57 |
Correct |
53 ms |
12804 KB |
Output is correct |
58 |
Correct |
54 ms |
12628 KB |
Output is correct |
59 |
Correct |
53 ms |
12628 KB |
Output is correct |
60 |
Correct |
54 ms |
12784 KB |
Output is correct |
61 |
Correct |
52 ms |
12624 KB |
Output is correct |
62 |
Correct |
52 ms |
12624 KB |
Output is correct |
63 |
Correct |
53 ms |
12624 KB |
Output is correct |
64 |
Correct |
53 ms |
12800 KB |
Output is correct |
65 |
Correct |
53 ms |
12744 KB |
Output is correct |
66 |
Correct |
53 ms |
12628 KB |
Output is correct |
67 |
Correct |
53 ms |
12628 KB |
Output is correct |
68 |
Correct |
53 ms |
12624 KB |
Output is correct |
69 |
Correct |
52 ms |
12792 KB |
Output is correct |
70 |
Correct |
53 ms |
12804 KB |
Output is correct |
71 |
Correct |
11 ms |
9048 KB |
Output is correct |
72 |
Correct |
11 ms |
9196 KB |
Output is correct |
73 |
Correct |
11 ms |
9052 KB |
Output is correct |
74 |
Correct |
10 ms |
9052 KB |
Output is correct |
75 |
Correct |
10 ms |
9052 KB |
Output is correct |
76 |
Correct |
23 ms |
9300 KB |
Output is correct |
77 |
Correct |
22 ms |
9308 KB |
Output is correct |
78 |
Correct |
22 ms |
9524 KB |
Output is correct |
79 |
Correct |
22 ms |
9308 KB |
Output is correct |
80 |
Correct |
22 ms |
9516 KB |
Output is correct |
81 |
Correct |
47 ms |
10576 KB |
Output is correct |
82 |
Correct |
46 ms |
10580 KB |
Output is correct |
83 |
Correct |
46 ms |
10576 KB |
Output is correct |
84 |
Correct |
46 ms |
10576 KB |
Output is correct |
85 |
Correct |
47 ms |
10436 KB |
Output is correct |
86 |
Correct |
54 ms |
11092 KB |
Output is correct |
87 |
Correct |
54 ms |
11092 KB |
Output is correct |
88 |
Correct |
56 ms |
11352 KB |
Output is correct |
89 |
Correct |
55 ms |
11156 KB |
Output is correct |
90 |
Correct |
54 ms |
11088 KB |
Output is correct |
91 |
Correct |
113 ms |
18004 KB |
Output is correct |
92 |
Correct |
112 ms |
18004 KB |
Output is correct |
93 |
Correct |
115 ms |
18004 KB |
Output is correct |
94 |
Correct |
113 ms |
18004 KB |
Output is correct |
95 |
Correct |
112 ms |
18004 KB |
Output is correct |
96 |
Correct |
144 ms |
22664 KB |
Output is correct |
97 |
Correct |
148 ms |
22784 KB |
Output is correct |
98 |
Correct |
143 ms |
22864 KB |
Output is correct |
99 |
Correct |
145 ms |
22864 KB |
Output is correct |
100 |
Correct |
145 ms |
22872 KB |
Output is correct |
101 |
Correct |
146 ms |
22876 KB |
Output is correct |
102 |
Correct |
143 ms |
22888 KB |
Output is correct |
103 |
Correct |
145 ms |
22744 KB |
Output is correct |
104 |
Correct |
150 ms |
22868 KB |
Output is correct |
105 |
Correct |
149 ms |
22880 KB |
Output is correct |
106 |
Correct |
159 ms |
25168 KB |
Output is correct |
107 |
Correct |
158 ms |
25172 KB |
Output is correct |
108 |
Correct |
158 ms |
25424 KB |
Output is correct |
109 |
Correct |
157 ms |
25172 KB |
Output is correct |
110 |
Correct |
161 ms |
25168 KB |
Output is correct |
111 |
Correct |
161 ms |
25272 KB |
Output is correct |
112 |
Correct |
159 ms |
25172 KB |
Output is correct |
113 |
Correct |
156 ms |
25168 KB |
Output is correct |
114 |
Correct |
176 ms |
25276 KB |
Output is correct |
115 |
Correct |
158 ms |
25168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
6488 KB |
Output is correct |
2 |
Correct |
1 ms |
6492 KB |
Output is correct |
3 |
Correct |
1 ms |
6492 KB |
Output is correct |
4 |
Correct |
1 ms |
6492 KB |
Output is correct |
5 |
Correct |
1 ms |
6492 KB |
Output is correct |
6 |
Correct |
1 ms |
6492 KB |
Output is correct |
7 |
Correct |
1 ms |
6488 KB |
Output is correct |
8 |
Correct |
1 ms |
6492 KB |
Output is correct |
9 |
Correct |
1 ms |
6492 KB |
Output is correct |
10 |
Correct |
1 ms |
6492 KB |
Output is correct |
11 |
Correct |
1 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
6492 KB |
Output is correct |
13 |
Correct |
2 ms |
6492 KB |
Output is correct |
14 |
Correct |
14 ms |
9028 KB |
Output is correct |
15 |
Correct |
26 ms |
9552 KB |
Output is correct |
16 |
Correct |
42 ms |
12108 KB |
Output is correct |
17 |
Correct |
44 ms |
12208 KB |
Output is correct |
18 |
Correct |
41 ms |
12220 KB |
Output is correct |
19 |
Correct |
42 ms |
11984 KB |
Output is correct |
20 |
Correct |
41 ms |
12016 KB |
Output is correct |
21 |
Correct |
42 ms |
12112 KB |
Output is correct |
22 |
Correct |
41 ms |
12124 KB |
Output is correct |
23 |
Correct |
42 ms |
12116 KB |
Output is correct |
24 |
Correct |
42 ms |
12244 KB |
Output is correct |
25 |
Correct |
41 ms |
12116 KB |
Output is correct |
26 |
Correct |
1 ms |
6492 KB |
Output is correct |
27 |
Correct |
1 ms |
6492 KB |
Output is correct |
28 |
Correct |
2 ms |
6492 KB |
Output is correct |
29 |
Correct |
15 ms |
9052 KB |
Output is correct |
30 |
Correct |
28 ms |
9564 KB |
Output is correct |
31 |
Correct |
43 ms |
12372 KB |
Output is correct |
32 |
Correct |
46 ms |
12372 KB |
Output is correct |
33 |
Correct |
43 ms |
12368 KB |
Output is correct |
34 |
Correct |
44 ms |
12372 KB |
Output is correct |
35 |
Correct |
43 ms |
12136 KB |
Output is correct |
36 |
Correct |
44 ms |
12120 KB |
Output is correct |
37 |
Correct |
44 ms |
12380 KB |
Output is correct |
38 |
Correct |
45 ms |
12324 KB |
Output is correct |
39 |
Correct |
43 ms |
12116 KB |
Output is correct |
40 |
Correct |
43 ms |
12300 KB |
Output is correct |
41 |
Correct |
1 ms |
6492 KB |
Output is correct |
42 |
Correct |
1 ms |
6492 KB |
Output is correct |
43 |
Correct |
1 ms |
6492 KB |
Output is correct |
44 |
Correct |
3 ms |
6620 KB |
Output is correct |
45 |
Correct |
2 ms |
6748 KB |
Output is correct |
46 |
Correct |
3 ms |
6748 KB |
Output is correct |
47 |
Correct |
9 ms |
9048 KB |
Output is correct |
48 |
Correct |
10 ms |
9052 KB |
Output is correct |
49 |
Correct |
18 ms |
9052 KB |
Output is correct |
50 |
Correct |
36 ms |
9872 KB |
Output is correct |
51 |
Correct |
54 ms |
12628 KB |
Output is correct |
52 |
Correct |
52 ms |
12796 KB |
Output is correct |
53 |
Correct |
52 ms |
12624 KB |
Output is correct |
54 |
Correct |
53 ms |
12808 KB |
Output is correct |
55 |
Correct |
54 ms |
12788 KB |
Output is correct |
56 |
Correct |
53 ms |
12792 KB |
Output is correct |
57 |
Correct |
53 ms |
12804 KB |
Output is correct |
58 |
Correct |
54 ms |
12628 KB |
Output is correct |
59 |
Correct |
53 ms |
12628 KB |
Output is correct |
60 |
Correct |
54 ms |
12784 KB |
Output is correct |
61 |
Correct |
52 ms |
12624 KB |
Output is correct |
62 |
Correct |
52 ms |
12624 KB |
Output is correct |
63 |
Correct |
53 ms |
12624 KB |
Output is correct |
64 |
Correct |
53 ms |
12800 KB |
Output is correct |
65 |
Correct |
53 ms |
12744 KB |
Output is correct |
66 |
Correct |
53 ms |
12628 KB |
Output is correct |
67 |
Correct |
53 ms |
12628 KB |
Output is correct |
68 |
Correct |
53 ms |
12624 KB |
Output is correct |
69 |
Correct |
52 ms |
12792 KB |
Output is correct |
70 |
Correct |
53 ms |
12804 KB |
Output is correct |
71 |
Correct |
11 ms |
9048 KB |
Output is correct |
72 |
Correct |
11 ms |
9196 KB |
Output is correct |
73 |
Correct |
11 ms |
9052 KB |
Output is correct |
74 |
Correct |
10 ms |
9052 KB |
Output is correct |
75 |
Correct |
10 ms |
9052 KB |
Output is correct |
76 |
Correct |
23 ms |
9300 KB |
Output is correct |
77 |
Correct |
22 ms |
9308 KB |
Output is correct |
78 |
Correct |
22 ms |
9524 KB |
Output is correct |
79 |
Correct |
22 ms |
9308 KB |
Output is correct |
80 |
Correct |
22 ms |
9516 KB |
Output is correct |
81 |
Correct |
47 ms |
10576 KB |
Output is correct |
82 |
Correct |
46 ms |
10580 KB |
Output is correct |
83 |
Correct |
46 ms |
10576 KB |
Output is correct |
84 |
Correct |
46 ms |
10576 KB |
Output is correct |
85 |
Correct |
47 ms |
10436 KB |
Output is correct |
86 |
Correct |
54 ms |
11092 KB |
Output is correct |
87 |
Correct |
54 ms |
11092 KB |
Output is correct |
88 |
Correct |
56 ms |
11352 KB |
Output is correct |
89 |
Correct |
55 ms |
11156 KB |
Output is correct |
90 |
Correct |
54 ms |
11088 KB |
Output is correct |
91 |
Correct |
113 ms |
18004 KB |
Output is correct |
92 |
Correct |
112 ms |
18004 KB |
Output is correct |
93 |
Correct |
115 ms |
18004 KB |
Output is correct |
94 |
Correct |
113 ms |
18004 KB |
Output is correct |
95 |
Correct |
112 ms |
18004 KB |
Output is correct |
96 |
Correct |
144 ms |
22664 KB |
Output is correct |
97 |
Correct |
148 ms |
22784 KB |
Output is correct |
98 |
Correct |
143 ms |
22864 KB |
Output is correct |
99 |
Correct |
145 ms |
22864 KB |
Output is correct |
100 |
Correct |
145 ms |
22872 KB |
Output is correct |
101 |
Correct |
146 ms |
22876 KB |
Output is correct |
102 |
Correct |
143 ms |
22888 KB |
Output is correct |
103 |
Correct |
145 ms |
22744 KB |
Output is correct |
104 |
Correct |
150 ms |
22868 KB |
Output is correct |
105 |
Correct |
149 ms |
22880 KB |
Output is correct |
106 |
Correct |
159 ms |
25168 KB |
Output is correct |
107 |
Correct |
158 ms |
25172 KB |
Output is correct |
108 |
Correct |
158 ms |
25424 KB |
Output is correct |
109 |
Correct |
157 ms |
25172 KB |
Output is correct |
110 |
Correct |
161 ms |
25168 KB |
Output is correct |
111 |
Correct |
161 ms |
25272 KB |
Output is correct |
112 |
Correct |
159 ms |
25172 KB |
Output is correct |
113 |
Correct |
156 ms |
25168 KB |
Output is correct |
114 |
Correct |
176 ms |
25276 KB |
Output is correct |
115 |
Correct |
158 ms |
25168 KB |
Output is correct |
116 |
Correct |
590 ms |
8276 KB |
Output is correct |
117 |
Correct |
481 ms |
8016 KB |
Output is correct |
118 |
Correct |
954 ms |
10628 KB |
Output is correct |
119 |
Correct |
659 ms |
11092 KB |
Output is correct |
120 |
Correct |
466 ms |
10720 KB |
Output is correct |
121 |
Correct |
987 ms |
10912 KB |
Output is correct |
122 |
Correct |
752 ms |
11020 KB |
Output is correct |
123 |
Correct |
2836 ms |
11704 KB |
Output is correct |
124 |
Correct |
1617 ms |
12116 KB |
Output is correct |
125 |
Correct |
1461 ms |
12372 KB |
Output is correct |
126 |
Execution timed out |
7027 ms |
13140 KB |
Time limit exceeded |
127 |
Halted |
0 ms |
0 KB |
- |