#include <bits/stdc++.h>
using namespace std;
#define int long long
const int B = 500;
const int V = 3e5;
int n,a[300005],q;
int fr[300005],aibfr[300005];
void update_fr(int pos,int val)
{
for (int i = pos; i <= V + 1; i += (i & -i))
aibfr[i] += val;
}
int query_fr(int pos)
{
int rr = 0;
for (int i = pos; i > 0; i -= (i & -i))
rr += aibfr[i];
return rr;
}
struct query
{
int l,r,idx;
};
bool cmp(query A1, query A2)
{
if (A1.l / B != A2.l / B)
return A1.l < A2.l;
return A1.r < A2.r;
}
query queries[50005];
int rasp[50005];
int ans1,ans2,ans3;
int v[300005];
int nre;
int aibv[300005],aibvii[300005];
void update_v(int pos,int val)
{
for (int i = pos; i <= V; i += (i & -i))
aibv[i] += val;
}
int query_v(int pos)
{
int rr = 0;
for (int i = pos; i > 0; i -= (i & -i))
rr += aibv[i];
return rr;
}
void update_vii(int pos,int val)
{
for (int i = pos; i <= V; i += (i & -i))
aibvii[i] += val;
}
int query_vii(int pos)
{
int rr = 0;
for (int i = pos; i > 0; i -= (i & -i))
rr += aibvii[i];
return rr;
}
void get_initial_ans()
{
vector<int> poz_fr;
for (int i = 1; i <= V; i++)
poz_fr.push_back(fr[i]);
sort(poz_fr.begin(),poz_fr.end());
int l1 = 1,r1 = V;
for (int i = 0; i < poz_fr.size(); i++)
{
if (i % 2 == 0)
v[l1] = poz_fr[i],l1++;
else
v[r1] = poz_fr[i],r1--;
}
for (int i = 1; i <= V; i++)
ans1 += v[i] * (v[i] + 1) / 2;
int sumvi = 0,sumivi = 0;
for (int j = 1; j <= V; j++)
{
ans3 += j * v[j] * sumvi - v[j] * sumivi;
ans2 += sumvi * v[j];
sumvi += v[j];
sumivi += j * v[j];
}
for (int i = 1; i <= V; i++)
update_v(i,v[i]);
for (int i = 1; i <= V; i++)
update_vii(i,v[i] * i);
}
void update_structure(int val,int coef)
{
//cout << val << ' ' << coef << endl;
ans1 -= fr[val] * (fr[val] + 1) / 2;
ans1 += (fr[val] + coef) * (fr[val] + coef + 1) / 2;
ans2 -= fr[val] * (nre - fr[val]);
ans2 += (fr[val] + coef) * (nre - fr[val]);
nre += coef;
int pos;
if (coef == 1)
pos = query_fr(fr[val] + 1);
else
pos = query_fr(fr[val] - 1 + 1) + 1;
if (pos % 2 == 1)
pos = (pos + 1) / 2;
else
pos = V - (pos - 1) / 2;
//cout << ans3 << endl;
//cout << pos << endl;
int delta = coef * pos * query_v(pos - 1) - coef * pos * (query_v(V) - query_v(pos)) + coef * (query_vii(V) - query_vii(pos)) - coef * query_vii(pos - 1);
ans3 += delta;
int new_val = v[pos] + coef;
update_v(pos,-v[pos]);
update_v(pos,new_val);
update_vii(pos,-v[pos] * pos);
update_vii(pos,new_val * pos);
v[pos] += coef;
fr[val] += coef;
//cout << fr[val] << ' ' << fr[val + coef] << endl;
//cout << 1 << endl;
update_fr(fr[val] - coef + 1,-1);
//cout << 3 << endl;
update_fr(fr[val] + 1,1);
//cout << 2 << endl;
}
///fr poate fi intre 0 si V, grija la aib!!
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> q;
for (int i = 1; i <= n; i++)
cin >> a[i],fr[a[i]]++;
get_initial_ans();
nre = n;
for (int i = 1; i <= q; i++)
{
cin >> queries[i].l >> queries[i].r;
queries[i].idx = i;
}
sort(queries + 1,queries + q + 1,cmp);
for (int i = 1; i <= V; i++)
update_fr(fr[i] + 1,1);
int l = 1,r = n;
for (int i = 1; i <= q; i++)
{
while (r < queries[i].r)
{
r++;
update_structure(a[r],1);
}
while (l > queries[i].l)
{
l--;
update_structure(a[l],1);
}
while (r > queries[i].r)
{
update_structure(a[r],-1);
r--;
}
while (l < queries[i].l)
{
update_structure(a[l],-1);
l++;
}
//cout << ans1 << ' ' << ans2 << ' ' << ans3 << endl;
rasp[queries[i].idx] = ans1 + ans2 + ans3;
}
for (int i = 1; i <= q; i++)
cout << rasp[i] << '\n';
return 0;
}
Compilation message
diversity.cpp: In function 'void get_initial_ans()':
diversity.cpp:82:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
82 | for (int i = 0; i < poz_fr.size(); i++)
| ~~^~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
17028 KB |
Output is correct |
2 |
Correct |
33 ms |
16592 KB |
Output is correct |
3 |
Correct |
31 ms |
15820 KB |
Output is correct |
4 |
Correct |
32 ms |
15312 KB |
Output is correct |
5 |
Correct |
32 ms |
15264 KB |
Output is correct |
6 |
Correct |
33 ms |
15568 KB |
Output is correct |
7 |
Correct |
33 ms |
15312 KB |
Output is correct |
8 |
Correct |
33 ms |
16336 KB |
Output is correct |
9 |
Correct |
32 ms |
16076 KB |
Output is correct |
10 |
Correct |
32 ms |
16080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
16336 KB |
Output is correct |
2 |
Correct |
32 ms |
15824 KB |
Output is correct |
3 |
Correct |
35 ms |
16332 KB |
Output is correct |
4 |
Correct |
35 ms |
16076 KB |
Output is correct |
5 |
Correct |
41 ms |
16336 KB |
Output is correct |
6 |
Correct |
43 ms |
18376 KB |
Output is correct |
7 |
Correct |
42 ms |
17096 KB |
Output is correct |
8 |
Correct |
42 ms |
17348 KB |
Output is correct |
9 |
Correct |
43 ms |
17092 KB |
Output is correct |
10 |
Correct |
43 ms |
17856 KB |
Output is correct |
11 |
Correct |
43 ms |
18628 KB |
Output is correct |
12 |
Correct |
43 ms |
17348 KB |
Output is correct |
13 |
Correct |
43 ms |
18884 KB |
Output is correct |
14 |
Correct |
44 ms |
17092 KB |
Output is correct |
15 |
Correct |
44 ms |
17348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
16336 KB |
Output is correct |
2 |
Correct |
32 ms |
15824 KB |
Output is correct |
3 |
Correct |
35 ms |
16332 KB |
Output is correct |
4 |
Correct |
35 ms |
16076 KB |
Output is correct |
5 |
Correct |
41 ms |
16336 KB |
Output is correct |
6 |
Correct |
43 ms |
18376 KB |
Output is correct |
7 |
Correct |
42 ms |
17096 KB |
Output is correct |
8 |
Correct |
42 ms |
17348 KB |
Output is correct |
9 |
Correct |
43 ms |
17092 KB |
Output is correct |
10 |
Correct |
43 ms |
17856 KB |
Output is correct |
11 |
Correct |
43 ms |
18628 KB |
Output is correct |
12 |
Correct |
43 ms |
17348 KB |
Output is correct |
13 |
Correct |
43 ms |
18884 KB |
Output is correct |
14 |
Correct |
44 ms |
17092 KB |
Output is correct |
15 |
Correct |
44 ms |
17348 KB |
Output is correct |
16 |
Correct |
33 ms |
15820 KB |
Output is correct |
17 |
Correct |
32 ms |
16588 KB |
Output is correct |
18 |
Correct |
33 ms |
16848 KB |
Output is correct |
19 |
Correct |
38 ms |
16592 KB |
Output is correct |
20 |
Correct |
42 ms |
17356 KB |
Output is correct |
21 |
Correct |
51 ms |
17348 KB |
Output is correct |
22 |
Correct |
46 ms |
18164 KB |
Output is correct |
23 |
Correct |
43 ms |
18616 KB |
Output is correct |
24 |
Correct |
43 ms |
17092 KB |
Output is correct |
25 |
Correct |
43 ms |
18124 KB |
Output is correct |
26 |
Correct |
45 ms |
17488 KB |
Output is correct |
27 |
Correct |
43 ms |
17868 KB |
Output is correct |
28 |
Correct |
43 ms |
17096 KB |
Output is correct |
29 |
Correct |
44 ms |
17792 KB |
Output is correct |
30 |
Correct |
44 ms |
17468 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
16336 KB |
Output is correct |
2 |
Correct |
32 ms |
15824 KB |
Output is correct |
3 |
Correct |
35 ms |
16332 KB |
Output is correct |
4 |
Correct |
35 ms |
16076 KB |
Output is correct |
5 |
Correct |
41 ms |
16336 KB |
Output is correct |
6 |
Correct |
43 ms |
18376 KB |
Output is correct |
7 |
Correct |
42 ms |
17096 KB |
Output is correct |
8 |
Correct |
42 ms |
17348 KB |
Output is correct |
9 |
Correct |
43 ms |
17092 KB |
Output is correct |
10 |
Correct |
43 ms |
17856 KB |
Output is correct |
11 |
Correct |
43 ms |
18628 KB |
Output is correct |
12 |
Correct |
43 ms |
17348 KB |
Output is correct |
13 |
Correct |
43 ms |
18884 KB |
Output is correct |
14 |
Correct |
44 ms |
17092 KB |
Output is correct |
15 |
Correct |
44 ms |
17348 KB |
Output is correct |
16 |
Correct |
33 ms |
15820 KB |
Output is correct |
17 |
Correct |
32 ms |
16588 KB |
Output is correct |
18 |
Correct |
33 ms |
16848 KB |
Output is correct |
19 |
Correct |
38 ms |
16592 KB |
Output is correct |
20 |
Correct |
42 ms |
17356 KB |
Output is correct |
21 |
Correct |
51 ms |
17348 KB |
Output is correct |
22 |
Correct |
46 ms |
18164 KB |
Output is correct |
23 |
Correct |
43 ms |
18616 KB |
Output is correct |
24 |
Correct |
43 ms |
17092 KB |
Output is correct |
25 |
Correct |
43 ms |
18124 KB |
Output is correct |
26 |
Correct |
45 ms |
17488 KB |
Output is correct |
27 |
Correct |
43 ms |
17868 KB |
Output is correct |
28 |
Correct |
43 ms |
17096 KB |
Output is correct |
29 |
Correct |
44 ms |
17792 KB |
Output is correct |
30 |
Correct |
44 ms |
17468 KB |
Output is correct |
31 |
Correct |
32 ms |
15620 KB |
Output is correct |
32 |
Correct |
33 ms |
16848 KB |
Output is correct |
33 |
Correct |
33 ms |
16588 KB |
Output is correct |
34 |
Correct |
32 ms |
15308 KB |
Output is correct |
35 |
Correct |
33 ms |
15980 KB |
Output is correct |
36 |
Correct |
33 ms |
16336 KB |
Output is correct |
37 |
Correct |
35 ms |
17356 KB |
Output is correct |
38 |
Correct |
34 ms |
15568 KB |
Output is correct |
39 |
Correct |
36 ms |
16332 KB |
Output is correct |
40 |
Correct |
40 ms |
17360 KB |
Output is correct |
41 |
Correct |
44 ms |
18116 KB |
Output is correct |
42 |
Correct |
44 ms |
18888 KB |
Output is correct |
43 |
Correct |
47 ms |
19404 KB |
Output is correct |
44 |
Correct |
45 ms |
18000 KB |
Output is correct |
45 |
Correct |
47 ms |
18376 KB |
Output is correct |
46 |
Correct |
47 ms |
19144 KB |
Output is correct |
47 |
Correct |
45 ms |
18636 KB |
Output is correct |
48 |
Correct |
45 ms |
19052 KB |
Output is correct |
49 |
Correct |
44 ms |
18832 KB |
Output is correct |
50 |
Correct |
45 ms |
18380 KB |
Output is correct |
51 |
Correct |
44 ms |
18888 KB |
Output is correct |
52 |
Correct |
46 ms |
18896 KB |
Output is correct |
53 |
Correct |
44 ms |
18636 KB |
Output is correct |
54 |
Correct |
44 ms |
18120 KB |
Output is correct |
55 |
Correct |
43 ms |
18076 KB |
Output is correct |
56 |
Correct |
44 ms |
17988 KB |
Output is correct |
57 |
Correct |
44 ms |
18628 KB |
Output is correct |
58 |
Correct |
44 ms |
17508 KB |
Output is correct |
59 |
Correct |
46 ms |
18128 KB |
Output is correct |
60 |
Correct |
44 ms |
18116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
17028 KB |
Output is correct |
2 |
Correct |
33 ms |
16592 KB |
Output is correct |
3 |
Correct |
31 ms |
15820 KB |
Output is correct |
4 |
Correct |
32 ms |
15312 KB |
Output is correct |
5 |
Correct |
32 ms |
15264 KB |
Output is correct |
6 |
Correct |
33 ms |
15568 KB |
Output is correct |
7 |
Correct |
33 ms |
15312 KB |
Output is correct |
8 |
Correct |
33 ms |
16336 KB |
Output is correct |
9 |
Correct |
32 ms |
16076 KB |
Output is correct |
10 |
Correct |
32 ms |
16080 KB |
Output is correct |
11 |
Correct |
34 ms |
16336 KB |
Output is correct |
12 |
Correct |
32 ms |
15824 KB |
Output is correct |
13 |
Correct |
35 ms |
16332 KB |
Output is correct |
14 |
Correct |
35 ms |
16076 KB |
Output is correct |
15 |
Correct |
41 ms |
16336 KB |
Output is correct |
16 |
Correct |
43 ms |
18376 KB |
Output is correct |
17 |
Correct |
42 ms |
17096 KB |
Output is correct |
18 |
Correct |
42 ms |
17348 KB |
Output is correct |
19 |
Correct |
43 ms |
17092 KB |
Output is correct |
20 |
Correct |
43 ms |
17856 KB |
Output is correct |
21 |
Correct |
43 ms |
18628 KB |
Output is correct |
22 |
Correct |
43 ms |
17348 KB |
Output is correct |
23 |
Correct |
43 ms |
18884 KB |
Output is correct |
24 |
Correct |
44 ms |
17092 KB |
Output is correct |
25 |
Correct |
44 ms |
17348 KB |
Output is correct |
26 |
Correct |
33 ms |
15820 KB |
Output is correct |
27 |
Correct |
32 ms |
16588 KB |
Output is correct |
28 |
Correct |
33 ms |
16848 KB |
Output is correct |
29 |
Correct |
38 ms |
16592 KB |
Output is correct |
30 |
Correct |
42 ms |
17356 KB |
Output is correct |
31 |
Correct |
51 ms |
17348 KB |
Output is correct |
32 |
Correct |
46 ms |
18164 KB |
Output is correct |
33 |
Correct |
43 ms |
18616 KB |
Output is correct |
34 |
Correct |
43 ms |
17092 KB |
Output is correct |
35 |
Correct |
43 ms |
18124 KB |
Output is correct |
36 |
Correct |
45 ms |
17488 KB |
Output is correct |
37 |
Correct |
43 ms |
17868 KB |
Output is correct |
38 |
Correct |
43 ms |
17096 KB |
Output is correct |
39 |
Correct |
44 ms |
17792 KB |
Output is correct |
40 |
Correct |
44 ms |
17468 KB |
Output is correct |
41 |
Correct |
32 ms |
15620 KB |
Output is correct |
42 |
Correct |
33 ms |
16848 KB |
Output is correct |
43 |
Correct |
33 ms |
16588 KB |
Output is correct |
44 |
Correct |
32 ms |
15308 KB |
Output is correct |
45 |
Correct |
33 ms |
15980 KB |
Output is correct |
46 |
Correct |
33 ms |
16336 KB |
Output is correct |
47 |
Correct |
35 ms |
17356 KB |
Output is correct |
48 |
Correct |
34 ms |
15568 KB |
Output is correct |
49 |
Correct |
36 ms |
16332 KB |
Output is correct |
50 |
Correct |
40 ms |
17360 KB |
Output is correct |
51 |
Correct |
44 ms |
18116 KB |
Output is correct |
52 |
Correct |
44 ms |
18888 KB |
Output is correct |
53 |
Correct |
47 ms |
19404 KB |
Output is correct |
54 |
Correct |
45 ms |
18000 KB |
Output is correct |
55 |
Correct |
47 ms |
18376 KB |
Output is correct |
56 |
Correct |
47 ms |
19144 KB |
Output is correct |
57 |
Correct |
45 ms |
18636 KB |
Output is correct |
58 |
Correct |
45 ms |
19052 KB |
Output is correct |
59 |
Correct |
44 ms |
18832 KB |
Output is correct |
60 |
Correct |
45 ms |
18380 KB |
Output is correct |
61 |
Correct |
44 ms |
18888 KB |
Output is correct |
62 |
Correct |
46 ms |
18896 KB |
Output is correct |
63 |
Correct |
44 ms |
18636 KB |
Output is correct |
64 |
Correct |
44 ms |
18120 KB |
Output is correct |
65 |
Correct |
43 ms |
18076 KB |
Output is correct |
66 |
Correct |
44 ms |
17988 KB |
Output is correct |
67 |
Correct |
44 ms |
18628 KB |
Output is correct |
68 |
Correct |
44 ms |
17508 KB |
Output is correct |
69 |
Correct |
46 ms |
18128 KB |
Output is correct |
70 |
Correct |
44 ms |
18116 KB |
Output is correct |
71 |
Correct |
39 ms |
16080 KB |
Output is correct |
72 |
Correct |
35 ms |
16316 KB |
Output is correct |
73 |
Correct |
35 ms |
15912 KB |
Output is correct |
74 |
Correct |
35 ms |
17104 KB |
Output is correct |
75 |
Correct |
36 ms |
15568 KB |
Output is correct |
76 |
Correct |
37 ms |
16080 KB |
Output is correct |
77 |
Correct |
42 ms |
16824 KB |
Output is correct |
78 |
Correct |
37 ms |
17104 KB |
Output is correct |
79 |
Correct |
36 ms |
15916 KB |
Output is correct |
80 |
Correct |
36 ms |
15824 KB |
Output is correct |
81 |
Correct |
43 ms |
18120 KB |
Output is correct |
82 |
Correct |
41 ms |
17104 KB |
Output is correct |
83 |
Correct |
42 ms |
16592 KB |
Output is correct |
84 |
Correct |
42 ms |
18124 KB |
Output is correct |
85 |
Correct |
41 ms |
16848 KB |
Output is correct |
86 |
Correct |
42 ms |
17104 KB |
Output is correct |
87 |
Correct |
42 ms |
17352 KB |
Output is correct |
88 |
Correct |
43 ms |
17096 KB |
Output is correct |
89 |
Correct |
42 ms |
16580 KB |
Output is correct |
90 |
Correct |
43 ms |
17616 KB |
Output is correct |
91 |
Correct |
49 ms |
18884 KB |
Output is correct |
92 |
Correct |
50 ms |
19408 KB |
Output is correct |
93 |
Correct |
51 ms |
18376 KB |
Output is correct |
94 |
Correct |
52 ms |
18120 KB |
Output is correct |
95 |
Correct |
50 ms |
18744 KB |
Output is correct |
96 |
Correct |
50 ms |
18888 KB |
Output is correct |
97 |
Correct |
50 ms |
18356 KB |
Output is correct |
98 |
Correct |
50 ms |
18372 KB |
Output is correct |
99 |
Correct |
52 ms |
18628 KB |
Output is correct |
100 |
Correct |
50 ms |
19148 KB |
Output is correct |
101 |
Correct |
50 ms |
19412 KB |
Output is correct |
102 |
Correct |
50 ms |
18884 KB |
Output is correct |
103 |
Correct |
54 ms |
18372 KB |
Output is correct |
104 |
Correct |
51 ms |
19140 KB |
Output is correct |
105 |
Correct |
52 ms |
19888 KB |
Output is correct |
106 |
Correct |
62 ms |
19140 KB |
Output is correct |
107 |
Correct |
50 ms |
18884 KB |
Output is correct |
108 |
Correct |
49 ms |
18428 KB |
Output is correct |
109 |
Correct |
50 ms |
18884 KB |
Output is correct |
110 |
Correct |
49 ms |
18368 KB |
Output is correct |
111 |
Correct |
51 ms |
19108 KB |
Output is correct |
112 |
Correct |
50 ms |
19656 KB |
Output is correct |
113 |
Correct |
50 ms |
19664 KB |
Output is correct |
114 |
Correct |
50 ms |
19908 KB |
Output is correct |
115 |
Correct |
52 ms |
18440 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
33 ms |
17028 KB |
Output is correct |
2 |
Correct |
33 ms |
16592 KB |
Output is correct |
3 |
Correct |
31 ms |
15820 KB |
Output is correct |
4 |
Correct |
32 ms |
15312 KB |
Output is correct |
5 |
Correct |
32 ms |
15264 KB |
Output is correct |
6 |
Correct |
33 ms |
15568 KB |
Output is correct |
7 |
Correct |
33 ms |
15312 KB |
Output is correct |
8 |
Correct |
33 ms |
16336 KB |
Output is correct |
9 |
Correct |
32 ms |
16076 KB |
Output is correct |
10 |
Correct |
32 ms |
16080 KB |
Output is correct |
11 |
Correct |
34 ms |
16336 KB |
Output is correct |
12 |
Correct |
32 ms |
15824 KB |
Output is correct |
13 |
Correct |
35 ms |
16332 KB |
Output is correct |
14 |
Correct |
35 ms |
16076 KB |
Output is correct |
15 |
Correct |
41 ms |
16336 KB |
Output is correct |
16 |
Correct |
43 ms |
18376 KB |
Output is correct |
17 |
Correct |
42 ms |
17096 KB |
Output is correct |
18 |
Correct |
42 ms |
17348 KB |
Output is correct |
19 |
Correct |
43 ms |
17092 KB |
Output is correct |
20 |
Correct |
43 ms |
17856 KB |
Output is correct |
21 |
Correct |
43 ms |
18628 KB |
Output is correct |
22 |
Correct |
43 ms |
17348 KB |
Output is correct |
23 |
Correct |
43 ms |
18884 KB |
Output is correct |
24 |
Correct |
44 ms |
17092 KB |
Output is correct |
25 |
Correct |
44 ms |
17348 KB |
Output is correct |
26 |
Correct |
33 ms |
15820 KB |
Output is correct |
27 |
Correct |
32 ms |
16588 KB |
Output is correct |
28 |
Correct |
33 ms |
16848 KB |
Output is correct |
29 |
Correct |
38 ms |
16592 KB |
Output is correct |
30 |
Correct |
42 ms |
17356 KB |
Output is correct |
31 |
Correct |
51 ms |
17348 KB |
Output is correct |
32 |
Correct |
46 ms |
18164 KB |
Output is correct |
33 |
Correct |
43 ms |
18616 KB |
Output is correct |
34 |
Correct |
43 ms |
17092 KB |
Output is correct |
35 |
Correct |
43 ms |
18124 KB |
Output is correct |
36 |
Correct |
45 ms |
17488 KB |
Output is correct |
37 |
Correct |
43 ms |
17868 KB |
Output is correct |
38 |
Correct |
43 ms |
17096 KB |
Output is correct |
39 |
Correct |
44 ms |
17792 KB |
Output is correct |
40 |
Correct |
44 ms |
17468 KB |
Output is correct |
41 |
Correct |
32 ms |
15620 KB |
Output is correct |
42 |
Correct |
33 ms |
16848 KB |
Output is correct |
43 |
Correct |
33 ms |
16588 KB |
Output is correct |
44 |
Correct |
32 ms |
15308 KB |
Output is correct |
45 |
Correct |
33 ms |
15980 KB |
Output is correct |
46 |
Correct |
33 ms |
16336 KB |
Output is correct |
47 |
Correct |
35 ms |
17356 KB |
Output is correct |
48 |
Correct |
34 ms |
15568 KB |
Output is correct |
49 |
Correct |
36 ms |
16332 KB |
Output is correct |
50 |
Correct |
40 ms |
17360 KB |
Output is correct |
51 |
Correct |
44 ms |
18116 KB |
Output is correct |
52 |
Correct |
44 ms |
18888 KB |
Output is correct |
53 |
Correct |
47 ms |
19404 KB |
Output is correct |
54 |
Correct |
45 ms |
18000 KB |
Output is correct |
55 |
Correct |
47 ms |
18376 KB |
Output is correct |
56 |
Correct |
47 ms |
19144 KB |
Output is correct |
57 |
Correct |
45 ms |
18636 KB |
Output is correct |
58 |
Correct |
45 ms |
19052 KB |
Output is correct |
59 |
Correct |
44 ms |
18832 KB |
Output is correct |
60 |
Correct |
45 ms |
18380 KB |
Output is correct |
61 |
Correct |
44 ms |
18888 KB |
Output is correct |
62 |
Correct |
46 ms |
18896 KB |
Output is correct |
63 |
Correct |
44 ms |
18636 KB |
Output is correct |
64 |
Correct |
44 ms |
18120 KB |
Output is correct |
65 |
Correct |
43 ms |
18076 KB |
Output is correct |
66 |
Correct |
44 ms |
17988 KB |
Output is correct |
67 |
Correct |
44 ms |
18628 KB |
Output is correct |
68 |
Correct |
44 ms |
17508 KB |
Output is correct |
69 |
Correct |
46 ms |
18128 KB |
Output is correct |
70 |
Correct |
44 ms |
18116 KB |
Output is correct |
71 |
Correct |
39 ms |
16080 KB |
Output is correct |
72 |
Correct |
35 ms |
16316 KB |
Output is correct |
73 |
Correct |
35 ms |
15912 KB |
Output is correct |
74 |
Correct |
35 ms |
17104 KB |
Output is correct |
75 |
Correct |
36 ms |
15568 KB |
Output is correct |
76 |
Correct |
37 ms |
16080 KB |
Output is correct |
77 |
Correct |
42 ms |
16824 KB |
Output is correct |
78 |
Correct |
37 ms |
17104 KB |
Output is correct |
79 |
Correct |
36 ms |
15916 KB |
Output is correct |
80 |
Correct |
36 ms |
15824 KB |
Output is correct |
81 |
Correct |
43 ms |
18120 KB |
Output is correct |
82 |
Correct |
41 ms |
17104 KB |
Output is correct |
83 |
Correct |
42 ms |
16592 KB |
Output is correct |
84 |
Correct |
42 ms |
18124 KB |
Output is correct |
85 |
Correct |
41 ms |
16848 KB |
Output is correct |
86 |
Correct |
42 ms |
17104 KB |
Output is correct |
87 |
Correct |
42 ms |
17352 KB |
Output is correct |
88 |
Correct |
43 ms |
17096 KB |
Output is correct |
89 |
Correct |
42 ms |
16580 KB |
Output is correct |
90 |
Correct |
43 ms |
17616 KB |
Output is correct |
91 |
Correct |
49 ms |
18884 KB |
Output is correct |
92 |
Correct |
50 ms |
19408 KB |
Output is correct |
93 |
Correct |
51 ms |
18376 KB |
Output is correct |
94 |
Correct |
52 ms |
18120 KB |
Output is correct |
95 |
Correct |
50 ms |
18744 KB |
Output is correct |
96 |
Correct |
50 ms |
18888 KB |
Output is correct |
97 |
Correct |
50 ms |
18356 KB |
Output is correct |
98 |
Correct |
50 ms |
18372 KB |
Output is correct |
99 |
Correct |
52 ms |
18628 KB |
Output is correct |
100 |
Correct |
50 ms |
19148 KB |
Output is correct |
101 |
Correct |
50 ms |
19412 KB |
Output is correct |
102 |
Correct |
50 ms |
18884 KB |
Output is correct |
103 |
Correct |
54 ms |
18372 KB |
Output is correct |
104 |
Correct |
51 ms |
19140 KB |
Output is correct |
105 |
Correct |
52 ms |
19888 KB |
Output is correct |
106 |
Correct |
62 ms |
19140 KB |
Output is correct |
107 |
Correct |
50 ms |
18884 KB |
Output is correct |
108 |
Correct |
49 ms |
18428 KB |
Output is correct |
109 |
Correct |
50 ms |
18884 KB |
Output is correct |
110 |
Correct |
49 ms |
18368 KB |
Output is correct |
111 |
Correct |
51 ms |
19108 KB |
Output is correct |
112 |
Correct |
50 ms |
19656 KB |
Output is correct |
113 |
Correct |
50 ms |
19664 KB |
Output is correct |
114 |
Correct |
50 ms |
19908 KB |
Output is correct |
115 |
Correct |
52 ms |
18440 KB |
Output is correct |
116 |
Correct |
1614 ms |
15880 KB |
Output is correct |
117 |
Correct |
1602 ms |
15892 KB |
Output is correct |
118 |
Correct |
2514 ms |
16844 KB |
Output is correct |
119 |
Correct |
2442 ms |
16264 KB |
Output is correct |
120 |
Correct |
2541 ms |
16384 KB |
Output is correct |
121 |
Correct |
5367 ms |
16592 KB |
Output is correct |
122 |
Correct |
5285 ms |
17360 KB |
Output is correct |
123 |
Execution timed out |
7029 ms |
17604 KB |
Time limit exceeded |
124 |
Halted |
0 ms |
0 KB |
- |