#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
const int B = 1340;
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;
else
{
if ((A1.l / B) % 2 == 0)
return A1.r < A2.r;
return A1.r > A2.r;
}
}
query queries[50005];
ll rasp[50005];
ll ans1,ans2,ans3;
int v[300005];
int nre;
int aibv[300005];
ll 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,ll val)
{
for (int i = pos; i <= V; i += (i & -i))
aibvii[i] += val;
}
ll query_vii(int pos)
{
ll rr = 0;
for (int i = pos; i > 0; i -= (i & -i))
rr += aibvii[i];
return rr;
}
ll sum_vii;
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 += 1ll * v[i] * (v[i] + 1) / 2;
ll sumvi = 0,sumivi = 0;
for (int j = 1; j <= V; j++)
{
ans3 += 1ll * j * v[j] * sumvi - 1ll * v[j] * sumivi;
ans2 += 1ll * sumvi * v[j];
sumvi += v[j];
sumivi += 1ll * j * v[j];
}
for (int i = 1; i <= V; i++)
sum_vii += 1ll * v[i] * i;
for (int i = 1; i <= V; i++)
update_v(i,v[i]);
for (int i = 1; i <= V; i++)
update_vii(i,1ll * v[i] * i);
}
void update_structure(int val,int coef)
{
//cout << val << ' ' << coef << endl;
ans1 -= 1ll * fr[val] * (fr[val] + 1) / 2;
ans1 += 1ll * (fr[val] + coef) * (fr[val] + coef + 1) / 2;
ans2 -= 1ll * fr[val] * (nre - fr[val]);
ans2 += 1ll * (fr[val] + coef) * (nre - fr[val]);
int pos;
if (coef == 1)
pos = query_fr(fr[val] + 1);
else
pos = query_fr(fr[val]) + 1;
if (pos % 2 == 1)
pos = (pos + 1) / 2;
else
pos = V - (pos - 1) / 2;
//cout << ans3 << endl;
//cout << pos << endl;
int qvp = query_v(pos);
ll qviip = query_vii(pos);
ll delta = 1ll * coef * pos * (qvp - v[pos]) - 1ll * coef * pos * (nre - qvp) + 1ll * coef * (sum_vii - qviip) - 1ll * coef * (qviip - 1ll * v[pos] * pos);
ans3 += delta;
int new_val = v[pos] + coef;
update_v(pos,coef);
update_vii(pos,coef * 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;
nre += coef;
sum_vii += 1ll * v[pos] * pos;
sum_vii -= 1ll * (v[pos] - coef) * pos;
}
///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:91:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
91 | for (int i = 0; i < poz_fr.size(); i++)
| ~~^~~~~~~~~~~~~~~
diversity.cpp: In function 'void update_structure(int, int)':
diversity.cpp:138:9: warning: unused variable 'new_val' [-Wunused-variable]
138 | int new_val = v[pos] + coef;
| ^~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
10192 KB |
Output is correct |
2 |
Correct |
24 ms |
9940 KB |
Output is correct |
3 |
Correct |
24 ms |
9940 KB |
Output is correct |
4 |
Correct |
24 ms |
9984 KB |
Output is correct |
5 |
Correct |
23 ms |
9940 KB |
Output is correct |
6 |
Correct |
24 ms |
9936 KB |
Output is correct |
7 |
Correct |
46 ms |
9940 KB |
Output is correct |
8 |
Correct |
45 ms |
9940 KB |
Output is correct |
9 |
Correct |
24 ms |
9940 KB |
Output is correct |
10 |
Correct |
24 ms |
9988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
9940 KB |
Output is correct |
2 |
Correct |
23 ms |
9936 KB |
Output is correct |
3 |
Correct |
24 ms |
9940 KB |
Output is correct |
4 |
Correct |
29 ms |
10192 KB |
Output is correct |
5 |
Correct |
30 ms |
10408 KB |
Output is correct |
6 |
Correct |
34 ms |
10700 KB |
Output is correct |
7 |
Correct |
34 ms |
10704 KB |
Output is correct |
8 |
Correct |
34 ms |
10700 KB |
Output is correct |
9 |
Correct |
33 ms |
10952 KB |
Output is correct |
10 |
Correct |
36 ms |
10796 KB |
Output is correct |
11 |
Correct |
34 ms |
10700 KB |
Output is correct |
12 |
Correct |
34 ms |
10696 KB |
Output is correct |
13 |
Correct |
34 ms |
10964 KB |
Output is correct |
14 |
Correct |
34 ms |
10796 KB |
Output is correct |
15 |
Correct |
33 ms |
10964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
9940 KB |
Output is correct |
2 |
Correct |
23 ms |
9936 KB |
Output is correct |
3 |
Correct |
24 ms |
9940 KB |
Output is correct |
4 |
Correct |
29 ms |
10192 KB |
Output is correct |
5 |
Correct |
30 ms |
10408 KB |
Output is correct |
6 |
Correct |
34 ms |
10700 KB |
Output is correct |
7 |
Correct |
34 ms |
10704 KB |
Output is correct |
8 |
Correct |
34 ms |
10700 KB |
Output is correct |
9 |
Correct |
33 ms |
10952 KB |
Output is correct |
10 |
Correct |
36 ms |
10796 KB |
Output is correct |
11 |
Correct |
34 ms |
10700 KB |
Output is correct |
12 |
Correct |
34 ms |
10696 KB |
Output is correct |
13 |
Correct |
34 ms |
10964 KB |
Output is correct |
14 |
Correct |
34 ms |
10796 KB |
Output is correct |
15 |
Correct |
33 ms |
10964 KB |
Output is correct |
16 |
Correct |
24 ms |
9940 KB |
Output is correct |
17 |
Correct |
24 ms |
9936 KB |
Output is correct |
18 |
Correct |
24 ms |
9940 KB |
Output is correct |
19 |
Correct |
27 ms |
10192 KB |
Output is correct |
20 |
Correct |
31 ms |
10564 KB |
Output is correct |
21 |
Correct |
35 ms |
10936 KB |
Output is correct |
22 |
Correct |
35 ms |
10788 KB |
Output is correct |
23 |
Correct |
41 ms |
10700 KB |
Output is correct |
24 |
Correct |
35 ms |
10964 KB |
Output is correct |
25 |
Correct |
36 ms |
10964 KB |
Output is correct |
26 |
Correct |
63 ms |
10964 KB |
Output is correct |
27 |
Correct |
35 ms |
10964 KB |
Output is correct |
28 |
Correct |
35 ms |
10796 KB |
Output is correct |
29 |
Correct |
35 ms |
10964 KB |
Output is correct |
30 |
Correct |
34 ms |
10812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
9940 KB |
Output is correct |
2 |
Correct |
23 ms |
9936 KB |
Output is correct |
3 |
Correct |
24 ms |
9940 KB |
Output is correct |
4 |
Correct |
29 ms |
10192 KB |
Output is correct |
5 |
Correct |
30 ms |
10408 KB |
Output is correct |
6 |
Correct |
34 ms |
10700 KB |
Output is correct |
7 |
Correct |
34 ms |
10704 KB |
Output is correct |
8 |
Correct |
34 ms |
10700 KB |
Output is correct |
9 |
Correct |
33 ms |
10952 KB |
Output is correct |
10 |
Correct |
36 ms |
10796 KB |
Output is correct |
11 |
Correct |
34 ms |
10700 KB |
Output is correct |
12 |
Correct |
34 ms |
10696 KB |
Output is correct |
13 |
Correct |
34 ms |
10964 KB |
Output is correct |
14 |
Correct |
34 ms |
10796 KB |
Output is correct |
15 |
Correct |
33 ms |
10964 KB |
Output is correct |
16 |
Correct |
24 ms |
9940 KB |
Output is correct |
17 |
Correct |
24 ms |
9936 KB |
Output is correct |
18 |
Correct |
24 ms |
9940 KB |
Output is correct |
19 |
Correct |
27 ms |
10192 KB |
Output is correct |
20 |
Correct |
31 ms |
10564 KB |
Output is correct |
21 |
Correct |
35 ms |
10936 KB |
Output is correct |
22 |
Correct |
35 ms |
10788 KB |
Output is correct |
23 |
Correct |
41 ms |
10700 KB |
Output is correct |
24 |
Correct |
35 ms |
10964 KB |
Output is correct |
25 |
Correct |
36 ms |
10964 KB |
Output is correct |
26 |
Correct |
63 ms |
10964 KB |
Output is correct |
27 |
Correct |
35 ms |
10964 KB |
Output is correct |
28 |
Correct |
35 ms |
10796 KB |
Output is correct |
29 |
Correct |
35 ms |
10964 KB |
Output is correct |
30 |
Correct |
34 ms |
10812 KB |
Output is correct |
31 |
Correct |
24 ms |
9984 KB |
Output is correct |
32 |
Correct |
24 ms |
9936 KB |
Output is correct |
33 |
Correct |
24 ms |
9940 KB |
Output is correct |
34 |
Correct |
24 ms |
9940 KB |
Output is correct |
35 |
Correct |
46 ms |
9996 KB |
Output is correct |
36 |
Correct |
25 ms |
9940 KB |
Output is correct |
37 |
Correct |
33 ms |
9940 KB |
Output is correct |
38 |
Correct |
26 ms |
9940 KB |
Output is correct |
39 |
Correct |
28 ms |
10196 KB |
Output is correct |
40 |
Correct |
32 ms |
10568 KB |
Output is correct |
41 |
Correct |
35 ms |
10964 KB |
Output is correct |
42 |
Correct |
65 ms |
10700 KB |
Output is correct |
43 |
Correct |
35 ms |
10960 KB |
Output is correct |
44 |
Correct |
37 ms |
10964 KB |
Output is correct |
45 |
Correct |
66 ms |
10952 KB |
Output is correct |
46 |
Correct |
36 ms |
10952 KB |
Output is correct |
47 |
Correct |
36 ms |
10960 KB |
Output is correct |
48 |
Correct |
37 ms |
10964 KB |
Output is correct |
49 |
Correct |
36 ms |
10804 KB |
Output is correct |
50 |
Correct |
37 ms |
10964 KB |
Output is correct |
51 |
Correct |
36 ms |
10964 KB |
Output is correct |
52 |
Correct |
66 ms |
10964 KB |
Output is correct |
53 |
Correct |
36 ms |
10700 KB |
Output is correct |
54 |
Correct |
35 ms |
10860 KB |
Output is correct |
55 |
Correct |
36 ms |
10964 KB |
Output is correct |
56 |
Correct |
35 ms |
10792 KB |
Output is correct |
57 |
Correct |
35 ms |
10860 KB |
Output is correct |
58 |
Correct |
36 ms |
10700 KB |
Output is correct |
59 |
Correct |
36 ms |
10776 KB |
Output is correct |
60 |
Correct |
35 ms |
10872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
10192 KB |
Output is correct |
2 |
Correct |
24 ms |
9940 KB |
Output is correct |
3 |
Correct |
24 ms |
9940 KB |
Output is correct |
4 |
Correct |
24 ms |
9984 KB |
Output is correct |
5 |
Correct |
23 ms |
9940 KB |
Output is correct |
6 |
Correct |
24 ms |
9936 KB |
Output is correct |
7 |
Correct |
46 ms |
9940 KB |
Output is correct |
8 |
Correct |
45 ms |
9940 KB |
Output is correct |
9 |
Correct |
24 ms |
9940 KB |
Output is correct |
10 |
Correct |
24 ms |
9988 KB |
Output is correct |
11 |
Correct |
24 ms |
9940 KB |
Output is correct |
12 |
Correct |
23 ms |
9936 KB |
Output is correct |
13 |
Correct |
24 ms |
9940 KB |
Output is correct |
14 |
Correct |
29 ms |
10192 KB |
Output is correct |
15 |
Correct |
30 ms |
10408 KB |
Output is correct |
16 |
Correct |
34 ms |
10700 KB |
Output is correct |
17 |
Correct |
34 ms |
10704 KB |
Output is correct |
18 |
Correct |
34 ms |
10700 KB |
Output is correct |
19 |
Correct |
33 ms |
10952 KB |
Output is correct |
20 |
Correct |
36 ms |
10796 KB |
Output is correct |
21 |
Correct |
34 ms |
10700 KB |
Output is correct |
22 |
Correct |
34 ms |
10696 KB |
Output is correct |
23 |
Correct |
34 ms |
10964 KB |
Output is correct |
24 |
Correct |
34 ms |
10796 KB |
Output is correct |
25 |
Correct |
33 ms |
10964 KB |
Output is correct |
26 |
Correct |
24 ms |
9940 KB |
Output is correct |
27 |
Correct |
24 ms |
9936 KB |
Output is correct |
28 |
Correct |
24 ms |
9940 KB |
Output is correct |
29 |
Correct |
27 ms |
10192 KB |
Output is correct |
30 |
Correct |
31 ms |
10564 KB |
Output is correct |
31 |
Correct |
35 ms |
10936 KB |
Output is correct |
32 |
Correct |
35 ms |
10788 KB |
Output is correct |
33 |
Correct |
41 ms |
10700 KB |
Output is correct |
34 |
Correct |
35 ms |
10964 KB |
Output is correct |
35 |
Correct |
36 ms |
10964 KB |
Output is correct |
36 |
Correct |
63 ms |
10964 KB |
Output is correct |
37 |
Correct |
35 ms |
10964 KB |
Output is correct |
38 |
Correct |
35 ms |
10796 KB |
Output is correct |
39 |
Correct |
35 ms |
10964 KB |
Output is correct |
40 |
Correct |
34 ms |
10812 KB |
Output is correct |
41 |
Correct |
24 ms |
9984 KB |
Output is correct |
42 |
Correct |
24 ms |
9936 KB |
Output is correct |
43 |
Correct |
24 ms |
9940 KB |
Output is correct |
44 |
Correct |
24 ms |
9940 KB |
Output is correct |
45 |
Correct |
46 ms |
9996 KB |
Output is correct |
46 |
Correct |
25 ms |
9940 KB |
Output is correct |
47 |
Correct |
33 ms |
9940 KB |
Output is correct |
48 |
Correct |
26 ms |
9940 KB |
Output is correct |
49 |
Correct |
28 ms |
10196 KB |
Output is correct |
50 |
Correct |
32 ms |
10568 KB |
Output is correct |
51 |
Correct |
35 ms |
10964 KB |
Output is correct |
52 |
Correct |
65 ms |
10700 KB |
Output is correct |
53 |
Correct |
35 ms |
10960 KB |
Output is correct |
54 |
Correct |
37 ms |
10964 KB |
Output is correct |
55 |
Correct |
66 ms |
10952 KB |
Output is correct |
56 |
Correct |
36 ms |
10952 KB |
Output is correct |
57 |
Correct |
36 ms |
10960 KB |
Output is correct |
58 |
Correct |
37 ms |
10964 KB |
Output is correct |
59 |
Correct |
36 ms |
10804 KB |
Output is correct |
60 |
Correct |
37 ms |
10964 KB |
Output is correct |
61 |
Correct |
36 ms |
10964 KB |
Output is correct |
62 |
Correct |
66 ms |
10964 KB |
Output is correct |
63 |
Correct |
36 ms |
10700 KB |
Output is correct |
64 |
Correct |
35 ms |
10860 KB |
Output is correct |
65 |
Correct |
36 ms |
10964 KB |
Output is correct |
66 |
Correct |
35 ms |
10792 KB |
Output is correct |
67 |
Correct |
35 ms |
10860 KB |
Output is correct |
68 |
Correct |
36 ms |
10700 KB |
Output is correct |
69 |
Correct |
36 ms |
10776 KB |
Output is correct |
70 |
Correct |
35 ms |
10872 KB |
Output is correct |
71 |
Correct |
26 ms |
9936 KB |
Output is correct |
72 |
Correct |
26 ms |
9940 KB |
Output is correct |
73 |
Correct |
26 ms |
9940 KB |
Output is correct |
74 |
Correct |
27 ms |
9940 KB |
Output is correct |
75 |
Correct |
26 ms |
9940 KB |
Output is correct |
76 |
Correct |
28 ms |
10196 KB |
Output is correct |
77 |
Correct |
54 ms |
10196 KB |
Output is correct |
78 |
Correct |
29 ms |
10196 KB |
Output is correct |
79 |
Correct |
32 ms |
10192 KB |
Output is correct |
80 |
Correct |
28 ms |
10196 KB |
Output is correct |
81 |
Correct |
62 ms |
10404 KB |
Output is correct |
82 |
Correct |
33 ms |
10444 KB |
Output is correct |
83 |
Correct |
33 ms |
10572 KB |
Output is correct |
84 |
Correct |
62 ms |
10704 KB |
Output is correct |
85 |
Correct |
33 ms |
10412 KB |
Output is correct |
86 |
Correct |
34 ms |
10416 KB |
Output is correct |
87 |
Correct |
34 ms |
10388 KB |
Output is correct |
88 |
Correct |
34 ms |
10452 KB |
Output is correct |
89 |
Correct |
34 ms |
10408 KB |
Output is correct |
90 |
Correct |
34 ms |
10448 KB |
Output is correct |
91 |
Correct |
40 ms |
10964 KB |
Output is correct |
92 |
Correct |
40 ms |
10960 KB |
Output is correct |
93 |
Correct |
40 ms |
10908 KB |
Output is correct |
94 |
Correct |
41 ms |
10964 KB |
Output is correct |
95 |
Correct |
40 ms |
10696 KB |
Output is correct |
96 |
Correct |
42 ms |
10696 KB |
Output is correct |
97 |
Correct |
42 ms |
10952 KB |
Output is correct |
98 |
Correct |
42 ms |
10960 KB |
Output is correct |
99 |
Correct |
76 ms |
10776 KB |
Output is correct |
100 |
Correct |
42 ms |
10964 KB |
Output is correct |
101 |
Correct |
68 ms |
10832 KB |
Output is correct |
102 |
Correct |
41 ms |
10788 KB |
Output is correct |
103 |
Correct |
41 ms |
10964 KB |
Output is correct |
104 |
Correct |
42 ms |
10824 KB |
Output is correct |
105 |
Correct |
42 ms |
10964 KB |
Output is correct |
106 |
Correct |
43 ms |
10780 KB |
Output is correct |
107 |
Correct |
41 ms |
10824 KB |
Output is correct |
108 |
Correct |
72 ms |
10696 KB |
Output is correct |
109 |
Correct |
43 ms |
10820 KB |
Output is correct |
110 |
Correct |
41 ms |
10700 KB |
Output is correct |
111 |
Correct |
43 ms |
10868 KB |
Output is correct |
112 |
Correct |
42 ms |
10952 KB |
Output is correct |
113 |
Correct |
44 ms |
10964 KB |
Output is correct |
114 |
Correct |
42 ms |
10952 KB |
Output is correct |
115 |
Correct |
41 ms |
10700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
10192 KB |
Output is correct |
2 |
Correct |
24 ms |
9940 KB |
Output is correct |
3 |
Correct |
24 ms |
9940 KB |
Output is correct |
4 |
Correct |
24 ms |
9984 KB |
Output is correct |
5 |
Correct |
23 ms |
9940 KB |
Output is correct |
6 |
Correct |
24 ms |
9936 KB |
Output is correct |
7 |
Correct |
46 ms |
9940 KB |
Output is correct |
8 |
Correct |
45 ms |
9940 KB |
Output is correct |
9 |
Correct |
24 ms |
9940 KB |
Output is correct |
10 |
Correct |
24 ms |
9988 KB |
Output is correct |
11 |
Correct |
24 ms |
9940 KB |
Output is correct |
12 |
Correct |
23 ms |
9936 KB |
Output is correct |
13 |
Correct |
24 ms |
9940 KB |
Output is correct |
14 |
Correct |
29 ms |
10192 KB |
Output is correct |
15 |
Correct |
30 ms |
10408 KB |
Output is correct |
16 |
Correct |
34 ms |
10700 KB |
Output is correct |
17 |
Correct |
34 ms |
10704 KB |
Output is correct |
18 |
Correct |
34 ms |
10700 KB |
Output is correct |
19 |
Correct |
33 ms |
10952 KB |
Output is correct |
20 |
Correct |
36 ms |
10796 KB |
Output is correct |
21 |
Correct |
34 ms |
10700 KB |
Output is correct |
22 |
Correct |
34 ms |
10696 KB |
Output is correct |
23 |
Correct |
34 ms |
10964 KB |
Output is correct |
24 |
Correct |
34 ms |
10796 KB |
Output is correct |
25 |
Correct |
33 ms |
10964 KB |
Output is correct |
26 |
Correct |
24 ms |
9940 KB |
Output is correct |
27 |
Correct |
24 ms |
9936 KB |
Output is correct |
28 |
Correct |
24 ms |
9940 KB |
Output is correct |
29 |
Correct |
27 ms |
10192 KB |
Output is correct |
30 |
Correct |
31 ms |
10564 KB |
Output is correct |
31 |
Correct |
35 ms |
10936 KB |
Output is correct |
32 |
Correct |
35 ms |
10788 KB |
Output is correct |
33 |
Correct |
41 ms |
10700 KB |
Output is correct |
34 |
Correct |
35 ms |
10964 KB |
Output is correct |
35 |
Correct |
36 ms |
10964 KB |
Output is correct |
36 |
Correct |
63 ms |
10964 KB |
Output is correct |
37 |
Correct |
35 ms |
10964 KB |
Output is correct |
38 |
Correct |
35 ms |
10796 KB |
Output is correct |
39 |
Correct |
35 ms |
10964 KB |
Output is correct |
40 |
Correct |
34 ms |
10812 KB |
Output is correct |
41 |
Correct |
24 ms |
9984 KB |
Output is correct |
42 |
Correct |
24 ms |
9936 KB |
Output is correct |
43 |
Correct |
24 ms |
9940 KB |
Output is correct |
44 |
Correct |
24 ms |
9940 KB |
Output is correct |
45 |
Correct |
46 ms |
9996 KB |
Output is correct |
46 |
Correct |
25 ms |
9940 KB |
Output is correct |
47 |
Correct |
33 ms |
9940 KB |
Output is correct |
48 |
Correct |
26 ms |
9940 KB |
Output is correct |
49 |
Correct |
28 ms |
10196 KB |
Output is correct |
50 |
Correct |
32 ms |
10568 KB |
Output is correct |
51 |
Correct |
35 ms |
10964 KB |
Output is correct |
52 |
Correct |
65 ms |
10700 KB |
Output is correct |
53 |
Correct |
35 ms |
10960 KB |
Output is correct |
54 |
Correct |
37 ms |
10964 KB |
Output is correct |
55 |
Correct |
66 ms |
10952 KB |
Output is correct |
56 |
Correct |
36 ms |
10952 KB |
Output is correct |
57 |
Correct |
36 ms |
10960 KB |
Output is correct |
58 |
Correct |
37 ms |
10964 KB |
Output is correct |
59 |
Correct |
36 ms |
10804 KB |
Output is correct |
60 |
Correct |
37 ms |
10964 KB |
Output is correct |
61 |
Correct |
36 ms |
10964 KB |
Output is correct |
62 |
Correct |
66 ms |
10964 KB |
Output is correct |
63 |
Correct |
36 ms |
10700 KB |
Output is correct |
64 |
Correct |
35 ms |
10860 KB |
Output is correct |
65 |
Correct |
36 ms |
10964 KB |
Output is correct |
66 |
Correct |
35 ms |
10792 KB |
Output is correct |
67 |
Correct |
35 ms |
10860 KB |
Output is correct |
68 |
Correct |
36 ms |
10700 KB |
Output is correct |
69 |
Correct |
36 ms |
10776 KB |
Output is correct |
70 |
Correct |
35 ms |
10872 KB |
Output is correct |
71 |
Correct |
26 ms |
9936 KB |
Output is correct |
72 |
Correct |
26 ms |
9940 KB |
Output is correct |
73 |
Correct |
26 ms |
9940 KB |
Output is correct |
74 |
Correct |
27 ms |
9940 KB |
Output is correct |
75 |
Correct |
26 ms |
9940 KB |
Output is correct |
76 |
Correct |
28 ms |
10196 KB |
Output is correct |
77 |
Correct |
54 ms |
10196 KB |
Output is correct |
78 |
Correct |
29 ms |
10196 KB |
Output is correct |
79 |
Correct |
32 ms |
10192 KB |
Output is correct |
80 |
Correct |
28 ms |
10196 KB |
Output is correct |
81 |
Correct |
62 ms |
10404 KB |
Output is correct |
82 |
Correct |
33 ms |
10444 KB |
Output is correct |
83 |
Correct |
33 ms |
10572 KB |
Output is correct |
84 |
Correct |
62 ms |
10704 KB |
Output is correct |
85 |
Correct |
33 ms |
10412 KB |
Output is correct |
86 |
Correct |
34 ms |
10416 KB |
Output is correct |
87 |
Correct |
34 ms |
10388 KB |
Output is correct |
88 |
Correct |
34 ms |
10452 KB |
Output is correct |
89 |
Correct |
34 ms |
10408 KB |
Output is correct |
90 |
Correct |
34 ms |
10448 KB |
Output is correct |
91 |
Correct |
40 ms |
10964 KB |
Output is correct |
92 |
Correct |
40 ms |
10960 KB |
Output is correct |
93 |
Correct |
40 ms |
10908 KB |
Output is correct |
94 |
Correct |
41 ms |
10964 KB |
Output is correct |
95 |
Correct |
40 ms |
10696 KB |
Output is correct |
96 |
Correct |
42 ms |
10696 KB |
Output is correct |
97 |
Correct |
42 ms |
10952 KB |
Output is correct |
98 |
Correct |
42 ms |
10960 KB |
Output is correct |
99 |
Correct |
76 ms |
10776 KB |
Output is correct |
100 |
Correct |
42 ms |
10964 KB |
Output is correct |
101 |
Correct |
68 ms |
10832 KB |
Output is correct |
102 |
Correct |
41 ms |
10788 KB |
Output is correct |
103 |
Correct |
41 ms |
10964 KB |
Output is correct |
104 |
Correct |
42 ms |
10824 KB |
Output is correct |
105 |
Correct |
42 ms |
10964 KB |
Output is correct |
106 |
Correct |
43 ms |
10780 KB |
Output is correct |
107 |
Correct |
41 ms |
10824 KB |
Output is correct |
108 |
Correct |
72 ms |
10696 KB |
Output is correct |
109 |
Correct |
43 ms |
10820 KB |
Output is correct |
110 |
Correct |
41 ms |
10700 KB |
Output is correct |
111 |
Correct |
43 ms |
10868 KB |
Output is correct |
112 |
Correct |
42 ms |
10952 KB |
Output is correct |
113 |
Correct |
44 ms |
10964 KB |
Output is correct |
114 |
Correct |
42 ms |
10952 KB |
Output is correct |
115 |
Correct |
41 ms |
10700 KB |
Output is correct |
116 |
Correct |
2936 ms |
9940 KB |
Output is correct |
117 |
Correct |
2471 ms |
9940 KB |
Output is correct |
118 |
Correct |
2692 ms |
9940 KB |
Output is correct |
119 |
Correct |
2636 ms |
9936 KB |
Output is correct |
120 |
Correct |
2769 ms |
9940 KB |
Output is correct |
121 |
Correct |
2824 ms |
10448 KB |
Output is correct |
122 |
Correct |
2802 ms |
10192 KB |
Output is correct |
123 |
Correct |
4347 ms |
10440 KB |
Output is correct |
124 |
Correct |
4532 ms |
10440 KB |
Output is correct |
125 |
Correct |
4685 ms |
10452 KB |
Output is correct |
126 |
Correct |
6145 ms |
10788 KB |
Output is correct |
127 |
Correct |
6354 ms |
10700 KB |
Output is correct |
128 |
Correct |
6349 ms |
10700 KB |
Output is correct |
129 |
Correct |
6344 ms |
10696 KB |
Output is correct |
130 |
Correct |
6283 ms |
10956 KB |
Output is correct |
131 |
Correct |
6276 ms |
10964 KB |
Output is correct |
132 |
Correct |
6288 ms |
10964 KB |
Output is correct |
133 |
Correct |
6314 ms |
10964 KB |
Output is correct |
134 |
Correct |
6294 ms |
10964 KB |
Output is correct |
135 |
Correct |
5956 ms |
10960 KB |
Output is correct |
136 |
Correct |
6293 ms |
10700 KB |
Output is correct |
137 |
Correct |
6375 ms |
11720 KB |
Output is correct |
138 |
Correct |
6279 ms |
11724 KB |
Output is correct |
139 |
Correct |
6384 ms |
11812 KB |
Output is correct |
140 |
Correct |
6268 ms |
10952 KB |
Output is correct |
141 |
Correct |
6296 ms |
10976 KB |
Output is correct |
142 |
Correct |
6255 ms |
10964 KB |
Output is correct |
143 |
Correct |
6342 ms |
10696 KB |
Output is correct |
144 |
Correct |
6283 ms |
11724 KB |
Output is correct |
145 |
Correct |
6348 ms |
11476 KB |
Output is correct |
146 |
Correct |
6676 ms |
11896 KB |
Output is correct |
147 |
Correct |
6585 ms |
11552 KB |
Output is correct |
148 |
Correct |
6566 ms |
11980 KB |
Output is correct |
149 |
Correct |
6679 ms |
12496 KB |
Output is correct |
150 |
Correct |
6623 ms |
12244 KB |
Output is correct |
151 |
Correct |
6831 ms |
12468 KB |
Output is correct |
152 |
Correct |
6833 ms |
12500 KB |
Output is correct |
153 |
Correct |
6826 ms |
12484 KB |
Output is correct |
154 |
Correct |
6702 ms |
12500 KB |
Output is correct |
155 |
Correct |
6746 ms |
12496 KB |
Output is correct |
156 |
Correct |
6916 ms |
12596 KB |
Output is correct |
157 |
Correct |
6957 ms |
12840 KB |
Output is correct |
158 |
Correct |
6856 ms |
12748 KB |
Output is correct |
159 |
Correct |
6540 ms |
12744 KB |
Output is correct |
160 |
Correct |
6875 ms |
12748 KB |
Output is correct |
161 |
Correct |
6445 ms |
12836 KB |
Output is correct |
162 |
Correct |
6707 ms |
12836 KB |
Output is correct |
163 |
Correct |
6658 ms |
12832 KB |
Output is correct |
164 |
Correct |
6786 ms |
12920 KB |
Output is correct |
165 |
Correct |
6761 ms |
12744 KB |
Output is correct |
166 |
Correct |
6320 ms |
12536 KB |
Output is correct |
167 |
Correct |
6362 ms |
12576 KB |
Output is correct |
168 |
Correct |
6368 ms |
12724 KB |
Output is correct |
169 |
Correct |
6048 ms |
12532 KB |
Output is correct |
170 |
Correct |
6189 ms |
12528 KB |
Output is correct |
171 |
Correct |
6242 ms |
12748 KB |
Output is correct |
172 |
Correct |
6298 ms |
12732 KB |
Output is correct |
173 |
Correct |
6309 ms |
12744 KB |
Output is correct |
174 |
Correct |
6287 ms |
12748 KB |
Output is correct |
175 |
Correct |
6273 ms |
12700 KB |
Output is correct |