#include <bits/stdc++.h>
#define MAX 305000
#define SQRT 800
using ll = long long;
ll array[MAX],freq[MAX];
ll N,Q;
typedef std::pair<ll,ll> pii;
typedef std::pair<pii,ll> ppi;
ll l[MAX],r[MAX],resp[MAX];
std::vector<ppi> queries;
ll sizes[MAX];
std::vector<ll> casos;
ll foier[MAX];
bool pesado[MAX];
void add(ll x){
ll elemento = array[x];
if(!pesado[elemento])
sizes[freq[elemento]]--;
++freq[elemento];
if(!pesado[elemento])
sizes[freq[elemento]]++;
}
void remove(ll x){
ll elemento = array[x];
if(!pesado[elemento])
sizes[freq[elemento]]--;
--freq[elemento];
if(!pesado[elemento])
sizes[freq[elemento]]++;
}
ll rodanda=42;
ll precomp[MAX];
typedef std::pair<ll,ll> pll;
ll gaussian(ll first,ll last,ll size){
return (first+last)*size/2LL;
}
std::vector<ll> separado;
ll getans(ll length){
++rodanda;
std::vector<pii> sz;
ll base=0;
for(ll i=1;i!=SQRT;++i){
base+=((i*(i+1))/2)*sizes[i];
if(sizes[i]){
sz.push_back({i,sizes[i]});
}
}
std::vector<pii> secondary;
for(auto&x:separado){
if(freq[x]){
base+=((freq[x]*(freq[x]+1))/2);
secondary.push_back({freq[x],1});
}
}
std::random_shuffle(secondary.begin(),secondary.end());
std::sort(secondary.begin(),secondary.end());
int c1=sz.size()-1,c2=secondary.size()-1;
std::deque<pll> ans;
ll count=0;
for(ll i = 0;i!=sz.size()+secondary.size();++i){
ll agora = count&1;
pii analise;
pii a1={-1,-1},a2={-1,-1};
if(c1>=0){
a1=sz[c1];
}
if(c2>=0){
a2=secondary[c2];
}
if(a1>a2){
analise=a1;
--c1;
}else {
analise=a2;
--c2;
}
ll metade_maior = analise.second/2 + (analise.second%2);
ll metade_menor = analise.second/2;
if(agora){
ans.push_back({analise.first,metade_maior});
ans.push_front({analise.first,metade_menor});
}else {
ans.push_front({analise.first,metade_maior});
ans.push_back({analise.first,metade_menor});
}
count+=analise.second;
}
ll res=0,somado=0;
ll foi=0;
for(ll i=0;i!=ans.size();++i){
ll tam = ans[i].first;
ll sum_somado=gaussian(somado,somado+(ans[i].second-1)*ans[i].first,ans[i].second);
ll sum_foi = gaussian(foi,foi+(ans[i].second-1),ans[i].second);
res+=ans[i].first*sum_somado;
res+=sum_foi*ans[i].first*ans[i].first;
res-=length*ans[i].first*sum_foi;
ll s=0;
ll tenta_prever=0,brute=0;
if(ans[i].second)
{
ll iteracoes = gaussian(0,ans[i].second-1,ans[i].second);
ll tamk = iteracoes*tam;
tenta_prever=ans[i].second*somado*foi;
tenta_prever+=somado*iteracoes;
tenta_prever+=iteracoes*tam*foi;
tenta_prever+=tam*precomp[ans[i].second-1];
}
tenta_prever*=2*tam;
res+=tenta_prever;
foi+=ans[i].second;
somado+=tam*ans[i].second;
}
return base+res;
}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
std::cout.tie(0);
for(ll i=1;i!=MAX;++i){
precomp[i]=precomp[i-1]+i*i;
}
std::map<int,int> aparece;
std::cin>>N>>Q;
for(ll i=0;i!=N;++i){
std::cin>>array[i];
aparece[array[i]]++;
}
std::vector<pii> mais_frequentes;
for(auto&x:aparece)mais_frequentes.push_back({x.second,x.first});
std::sort(mais_frequentes.begin(),mais_frequentes.end());
std::reverse(mais_frequentes.begin(),mais_frequentes.end());
for(int i=0;i<std::min((ll)mais_frequentes.size(),(ll)SQRT);++i){
separado.push_back(mais_frequentes[i].second);
pesado[mais_frequentes[i].second]=1;
}
for(ll i=0;i!=Q;++i){
std::cin>>l[i]>>r[i];
--l[i];--r[i];
queries.push_back({{l[i]/600,r[i]},i});
}
std::sort(queries.begin(),queries.end());
ll curl=0,curr=-1;
for(auto&x:queries){
ll querl = l[x.second],querr=r[x.second];
ll ans=0;
while(curr<querr){///Vai para a direita removendo elementos
++curr;
add(curr);
}
while(curl>querl){///Diminui o cursor aumentando elementos
--curl;
add(curl);
}
while(curl<querl){///Vai para a direita removendo elementos
remove(curl);
++curl;
}
while(curr>querr){///Diminui o cursor diminuindo elementos
remove(curr);
--curr;
}
ans=getans(querr-querl+1);
resp[x.second]=ans;
}
for(ll i=0;i!=Q;++i){
std::cout<<resp[i]<<"\n";
}
}
Compilation message
diversity.cpp: In function 'll getans(ll)':
diversity.cpp:60:16: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
60 | for(ll i = 0;i!=sz.size()+secondary.size();++i){
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
diversity.cpp:90:14: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::deque<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
90 | for(ll i=0;i!=ans.size();++i){
| ~^~~~~~~~~~~~
diversity.cpp:102:7: warning: unused variable 'tamk' [-Wunused-variable]
102 | ll tamk = iteracoes*tam;
| ^~~~
diversity.cpp:97:6: warning: unused variable 's' [-Wunused-variable]
97 | ll s=0;
| ^
diversity.cpp:98:21: warning: unused variable 'brute' [-Wunused-variable]
98 | ll tenta_prever=0,brute=0;
| ^~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2772 KB |
Output is correct |
4 |
Correct |
2 ms |
2772 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2732 KB |
Output is correct |
8 |
Correct |
2 ms |
2772 KB |
Output is correct |
9 |
Correct |
2 ms |
2732 KB |
Output is correct |
10 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2772 KB |
Output is correct |
2 |
Correct |
2 ms |
2772 KB |
Output is correct |
3 |
Correct |
3 ms |
2748 KB |
Output is correct |
4 |
Correct |
7 ms |
3640 KB |
Output is correct |
5 |
Correct |
12 ms |
4692 KB |
Output is correct |
6 |
Correct |
27 ms |
5716 KB |
Output is correct |
7 |
Correct |
17 ms |
5716 KB |
Output is correct |
8 |
Correct |
19 ms |
5692 KB |
Output is correct |
9 |
Correct |
19 ms |
5716 KB |
Output is correct |
10 |
Correct |
18 ms |
5692 KB |
Output is correct |
11 |
Correct |
27 ms |
5688 KB |
Output is correct |
12 |
Correct |
24 ms |
5680 KB |
Output is correct |
13 |
Correct |
21 ms |
5688 KB |
Output is correct |
14 |
Correct |
23 ms |
5612 KB |
Output is correct |
15 |
Correct |
19 ms |
5716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2772 KB |
Output is correct |
2 |
Correct |
2 ms |
2772 KB |
Output is correct |
3 |
Correct |
3 ms |
2748 KB |
Output is correct |
4 |
Correct |
7 ms |
3640 KB |
Output is correct |
5 |
Correct |
12 ms |
4692 KB |
Output is correct |
6 |
Correct |
27 ms |
5716 KB |
Output is correct |
7 |
Correct |
17 ms |
5716 KB |
Output is correct |
8 |
Correct |
19 ms |
5692 KB |
Output is correct |
9 |
Correct |
19 ms |
5716 KB |
Output is correct |
10 |
Correct |
18 ms |
5692 KB |
Output is correct |
11 |
Correct |
27 ms |
5688 KB |
Output is correct |
12 |
Correct |
24 ms |
5680 KB |
Output is correct |
13 |
Correct |
21 ms |
5688 KB |
Output is correct |
14 |
Correct |
23 ms |
5612 KB |
Output is correct |
15 |
Correct |
19 ms |
5716 KB |
Output is correct |
16 |
Correct |
2 ms |
2732 KB |
Output is correct |
17 |
Correct |
3 ms |
2736 KB |
Output is correct |
18 |
Correct |
3 ms |
2872 KB |
Output is correct |
19 |
Correct |
9 ms |
3812 KB |
Output is correct |
20 |
Correct |
16 ms |
4844 KB |
Output is correct |
21 |
Correct |
23 ms |
5828 KB |
Output is correct |
22 |
Correct |
22 ms |
5856 KB |
Output is correct |
23 |
Correct |
20 ms |
5896 KB |
Output is correct |
24 |
Correct |
21 ms |
5780 KB |
Output is correct |
25 |
Correct |
22 ms |
5856 KB |
Output is correct |
26 |
Correct |
27 ms |
5796 KB |
Output is correct |
27 |
Correct |
20 ms |
5820 KB |
Output is correct |
28 |
Correct |
21 ms |
5748 KB |
Output is correct |
29 |
Correct |
30 ms |
5784 KB |
Output is correct |
30 |
Correct |
21 ms |
5812 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2772 KB |
Output is correct |
2 |
Correct |
2 ms |
2772 KB |
Output is correct |
3 |
Correct |
3 ms |
2748 KB |
Output is correct |
4 |
Correct |
7 ms |
3640 KB |
Output is correct |
5 |
Correct |
12 ms |
4692 KB |
Output is correct |
6 |
Correct |
27 ms |
5716 KB |
Output is correct |
7 |
Correct |
17 ms |
5716 KB |
Output is correct |
8 |
Correct |
19 ms |
5692 KB |
Output is correct |
9 |
Correct |
19 ms |
5716 KB |
Output is correct |
10 |
Correct |
18 ms |
5692 KB |
Output is correct |
11 |
Correct |
27 ms |
5688 KB |
Output is correct |
12 |
Correct |
24 ms |
5680 KB |
Output is correct |
13 |
Correct |
21 ms |
5688 KB |
Output is correct |
14 |
Correct |
23 ms |
5612 KB |
Output is correct |
15 |
Correct |
19 ms |
5716 KB |
Output is correct |
16 |
Correct |
2 ms |
2732 KB |
Output is correct |
17 |
Correct |
3 ms |
2736 KB |
Output is correct |
18 |
Correct |
3 ms |
2872 KB |
Output is correct |
19 |
Correct |
9 ms |
3812 KB |
Output is correct |
20 |
Correct |
16 ms |
4844 KB |
Output is correct |
21 |
Correct |
23 ms |
5828 KB |
Output is correct |
22 |
Correct |
22 ms |
5856 KB |
Output is correct |
23 |
Correct |
20 ms |
5896 KB |
Output is correct |
24 |
Correct |
21 ms |
5780 KB |
Output is correct |
25 |
Correct |
22 ms |
5856 KB |
Output is correct |
26 |
Correct |
27 ms |
5796 KB |
Output is correct |
27 |
Correct |
20 ms |
5820 KB |
Output is correct |
28 |
Correct |
21 ms |
5748 KB |
Output is correct |
29 |
Correct |
30 ms |
5784 KB |
Output is correct |
30 |
Correct |
21 ms |
5812 KB |
Output is correct |
31 |
Correct |
2 ms |
2740 KB |
Output is correct |
32 |
Correct |
2 ms |
2772 KB |
Output is correct |
33 |
Correct |
3 ms |
2772 KB |
Output is correct |
34 |
Correct |
3 ms |
2900 KB |
Output is correct |
35 |
Correct |
3 ms |
2880 KB |
Output is correct |
36 |
Correct |
3 ms |
3008 KB |
Output is correct |
37 |
Correct |
7 ms |
3412 KB |
Output is correct |
38 |
Correct |
7 ms |
3468 KB |
Output is correct |
39 |
Correct |
12 ms |
4028 KB |
Output is correct |
40 |
Correct |
21 ms |
5196 KB |
Output is correct |
41 |
Correct |
36 ms |
6352 KB |
Output is correct |
42 |
Correct |
31 ms |
6300 KB |
Output is correct |
43 |
Correct |
32 ms |
6364 KB |
Output is correct |
44 |
Correct |
34 ms |
6256 KB |
Output is correct |
45 |
Correct |
31 ms |
6316 KB |
Output is correct |
46 |
Correct |
31 ms |
6352 KB |
Output is correct |
47 |
Correct |
31 ms |
6268 KB |
Output is correct |
48 |
Correct |
31 ms |
6356 KB |
Output is correct |
49 |
Correct |
31 ms |
6240 KB |
Output is correct |
50 |
Correct |
31 ms |
6300 KB |
Output is correct |
51 |
Correct |
31 ms |
6348 KB |
Output is correct |
52 |
Correct |
30 ms |
6240 KB |
Output is correct |
53 |
Correct |
31 ms |
6284 KB |
Output is correct |
54 |
Correct |
35 ms |
6400 KB |
Output is correct |
55 |
Correct |
31 ms |
6312 KB |
Output is correct |
56 |
Correct |
31 ms |
6296 KB |
Output is correct |
57 |
Correct |
31 ms |
6256 KB |
Output is correct |
58 |
Correct |
31 ms |
6288 KB |
Output is correct |
59 |
Correct |
31 ms |
6308 KB |
Output is correct |
60 |
Correct |
30 ms |
6348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2772 KB |
Output is correct |
4 |
Correct |
2 ms |
2772 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2732 KB |
Output is correct |
8 |
Correct |
2 ms |
2772 KB |
Output is correct |
9 |
Correct |
2 ms |
2732 KB |
Output is correct |
10 |
Correct |
2 ms |
2644 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2772 KB |
Output is correct |
13 |
Correct |
3 ms |
2748 KB |
Output is correct |
14 |
Correct |
7 ms |
3640 KB |
Output is correct |
15 |
Correct |
12 ms |
4692 KB |
Output is correct |
16 |
Correct |
27 ms |
5716 KB |
Output is correct |
17 |
Correct |
17 ms |
5716 KB |
Output is correct |
18 |
Correct |
19 ms |
5692 KB |
Output is correct |
19 |
Correct |
19 ms |
5716 KB |
Output is correct |
20 |
Correct |
18 ms |
5692 KB |
Output is correct |
21 |
Correct |
27 ms |
5688 KB |
Output is correct |
22 |
Correct |
24 ms |
5680 KB |
Output is correct |
23 |
Correct |
21 ms |
5688 KB |
Output is correct |
24 |
Correct |
23 ms |
5612 KB |
Output is correct |
25 |
Correct |
19 ms |
5716 KB |
Output is correct |
26 |
Correct |
2 ms |
2732 KB |
Output is correct |
27 |
Correct |
3 ms |
2736 KB |
Output is correct |
28 |
Correct |
3 ms |
2872 KB |
Output is correct |
29 |
Correct |
9 ms |
3812 KB |
Output is correct |
30 |
Correct |
16 ms |
4844 KB |
Output is correct |
31 |
Correct |
23 ms |
5828 KB |
Output is correct |
32 |
Correct |
22 ms |
5856 KB |
Output is correct |
33 |
Correct |
20 ms |
5896 KB |
Output is correct |
34 |
Correct |
21 ms |
5780 KB |
Output is correct |
35 |
Correct |
22 ms |
5856 KB |
Output is correct |
36 |
Correct |
27 ms |
5796 KB |
Output is correct |
37 |
Correct |
20 ms |
5820 KB |
Output is correct |
38 |
Correct |
21 ms |
5748 KB |
Output is correct |
39 |
Correct |
30 ms |
5784 KB |
Output is correct |
40 |
Correct |
21 ms |
5812 KB |
Output is correct |
41 |
Correct |
2 ms |
2740 KB |
Output is correct |
42 |
Correct |
2 ms |
2772 KB |
Output is correct |
43 |
Correct |
3 ms |
2772 KB |
Output is correct |
44 |
Correct |
3 ms |
2900 KB |
Output is correct |
45 |
Correct |
3 ms |
2880 KB |
Output is correct |
46 |
Correct |
3 ms |
3008 KB |
Output is correct |
47 |
Correct |
7 ms |
3412 KB |
Output is correct |
48 |
Correct |
7 ms |
3468 KB |
Output is correct |
49 |
Correct |
12 ms |
4028 KB |
Output is correct |
50 |
Correct |
21 ms |
5196 KB |
Output is correct |
51 |
Correct |
36 ms |
6352 KB |
Output is correct |
52 |
Correct |
31 ms |
6300 KB |
Output is correct |
53 |
Correct |
32 ms |
6364 KB |
Output is correct |
54 |
Correct |
34 ms |
6256 KB |
Output is correct |
55 |
Correct |
31 ms |
6316 KB |
Output is correct |
56 |
Correct |
31 ms |
6352 KB |
Output is correct |
57 |
Correct |
31 ms |
6268 KB |
Output is correct |
58 |
Correct |
31 ms |
6356 KB |
Output is correct |
59 |
Correct |
31 ms |
6240 KB |
Output is correct |
60 |
Correct |
31 ms |
6300 KB |
Output is correct |
61 |
Correct |
31 ms |
6348 KB |
Output is correct |
62 |
Correct |
30 ms |
6240 KB |
Output is correct |
63 |
Correct |
31 ms |
6284 KB |
Output is correct |
64 |
Correct |
35 ms |
6400 KB |
Output is correct |
65 |
Correct |
31 ms |
6312 KB |
Output is correct |
66 |
Correct |
31 ms |
6296 KB |
Output is correct |
67 |
Correct |
31 ms |
6256 KB |
Output is correct |
68 |
Correct |
31 ms |
6288 KB |
Output is correct |
69 |
Correct |
31 ms |
6308 KB |
Output is correct |
70 |
Correct |
30 ms |
6348 KB |
Output is correct |
71 |
Correct |
8 ms |
3540 KB |
Output is correct |
72 |
Correct |
8 ms |
3540 KB |
Output is correct |
73 |
Correct |
8 ms |
3496 KB |
Output is correct |
74 |
Correct |
8 ms |
3516 KB |
Output is correct |
75 |
Correct |
9 ms |
3540 KB |
Output is correct |
76 |
Correct |
16 ms |
4388 KB |
Output is correct |
77 |
Correct |
16 ms |
4468 KB |
Output is correct |
78 |
Correct |
17 ms |
4428 KB |
Output is correct |
79 |
Correct |
16 ms |
4432 KB |
Output is correct |
80 |
Correct |
16 ms |
4384 KB |
Output is correct |
81 |
Correct |
34 ms |
6096 KB |
Output is correct |
82 |
Correct |
33 ms |
6084 KB |
Output is correct |
83 |
Correct |
34 ms |
6068 KB |
Output is correct |
84 |
Correct |
33 ms |
6028 KB |
Output is correct |
85 |
Correct |
33 ms |
6112 KB |
Output is correct |
86 |
Correct |
40 ms |
6864 KB |
Output is correct |
87 |
Correct |
40 ms |
6956 KB |
Output is correct |
88 |
Correct |
40 ms |
6864 KB |
Output is correct |
89 |
Correct |
40 ms |
6936 KB |
Output is correct |
90 |
Correct |
40 ms |
6840 KB |
Output is correct |
91 |
Correct |
90 ms |
14092 KB |
Output is correct |
92 |
Correct |
90 ms |
14104 KB |
Output is correct |
93 |
Correct |
101 ms |
14100 KB |
Output is correct |
94 |
Correct |
94 ms |
14032 KB |
Output is correct |
95 |
Correct |
91 ms |
13988 KB |
Output is correct |
96 |
Correct |
137 ms |
21308 KB |
Output is correct |
97 |
Correct |
126 ms |
21308 KB |
Output is correct |
98 |
Correct |
128 ms |
21396 KB |
Output is correct |
99 |
Correct |
122 ms |
21376 KB |
Output is correct |
100 |
Correct |
124 ms |
21380 KB |
Output is correct |
101 |
Correct |
124 ms |
21400 KB |
Output is correct |
102 |
Correct |
136 ms |
21292 KB |
Output is correct |
103 |
Correct |
130 ms |
21360 KB |
Output is correct |
104 |
Correct |
125 ms |
21404 KB |
Output is correct |
105 |
Correct |
124 ms |
21288 KB |
Output is correct |
106 |
Correct |
163 ms |
25184 KB |
Output is correct |
107 |
Correct |
144 ms |
24992 KB |
Output is correct |
108 |
Correct |
141 ms |
25016 KB |
Output is correct |
109 |
Correct |
139 ms |
24988 KB |
Output is correct |
110 |
Correct |
168 ms |
24980 KB |
Output is correct |
111 |
Correct |
142 ms |
24888 KB |
Output is correct |
112 |
Correct |
143 ms |
24952 KB |
Output is correct |
113 |
Correct |
139 ms |
24980 KB |
Output is correct |
114 |
Correct |
150 ms |
24968 KB |
Output is correct |
115 |
Correct |
141 ms |
24948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2644 KB |
Output is correct |
2 |
Correct |
2 ms |
2644 KB |
Output is correct |
3 |
Correct |
2 ms |
2772 KB |
Output is correct |
4 |
Correct |
2 ms |
2772 KB |
Output is correct |
5 |
Correct |
2 ms |
2644 KB |
Output is correct |
6 |
Correct |
2 ms |
2644 KB |
Output is correct |
7 |
Correct |
2 ms |
2732 KB |
Output is correct |
8 |
Correct |
2 ms |
2772 KB |
Output is correct |
9 |
Correct |
2 ms |
2732 KB |
Output is correct |
10 |
Correct |
2 ms |
2644 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2772 KB |
Output is correct |
13 |
Correct |
3 ms |
2748 KB |
Output is correct |
14 |
Correct |
7 ms |
3640 KB |
Output is correct |
15 |
Correct |
12 ms |
4692 KB |
Output is correct |
16 |
Correct |
27 ms |
5716 KB |
Output is correct |
17 |
Correct |
17 ms |
5716 KB |
Output is correct |
18 |
Correct |
19 ms |
5692 KB |
Output is correct |
19 |
Correct |
19 ms |
5716 KB |
Output is correct |
20 |
Correct |
18 ms |
5692 KB |
Output is correct |
21 |
Correct |
27 ms |
5688 KB |
Output is correct |
22 |
Correct |
24 ms |
5680 KB |
Output is correct |
23 |
Correct |
21 ms |
5688 KB |
Output is correct |
24 |
Correct |
23 ms |
5612 KB |
Output is correct |
25 |
Correct |
19 ms |
5716 KB |
Output is correct |
26 |
Correct |
2 ms |
2732 KB |
Output is correct |
27 |
Correct |
3 ms |
2736 KB |
Output is correct |
28 |
Correct |
3 ms |
2872 KB |
Output is correct |
29 |
Correct |
9 ms |
3812 KB |
Output is correct |
30 |
Correct |
16 ms |
4844 KB |
Output is correct |
31 |
Correct |
23 ms |
5828 KB |
Output is correct |
32 |
Correct |
22 ms |
5856 KB |
Output is correct |
33 |
Correct |
20 ms |
5896 KB |
Output is correct |
34 |
Correct |
21 ms |
5780 KB |
Output is correct |
35 |
Correct |
22 ms |
5856 KB |
Output is correct |
36 |
Correct |
27 ms |
5796 KB |
Output is correct |
37 |
Correct |
20 ms |
5820 KB |
Output is correct |
38 |
Correct |
21 ms |
5748 KB |
Output is correct |
39 |
Correct |
30 ms |
5784 KB |
Output is correct |
40 |
Correct |
21 ms |
5812 KB |
Output is correct |
41 |
Correct |
2 ms |
2740 KB |
Output is correct |
42 |
Correct |
2 ms |
2772 KB |
Output is correct |
43 |
Correct |
3 ms |
2772 KB |
Output is correct |
44 |
Correct |
3 ms |
2900 KB |
Output is correct |
45 |
Correct |
3 ms |
2880 KB |
Output is correct |
46 |
Correct |
3 ms |
3008 KB |
Output is correct |
47 |
Correct |
7 ms |
3412 KB |
Output is correct |
48 |
Correct |
7 ms |
3468 KB |
Output is correct |
49 |
Correct |
12 ms |
4028 KB |
Output is correct |
50 |
Correct |
21 ms |
5196 KB |
Output is correct |
51 |
Correct |
36 ms |
6352 KB |
Output is correct |
52 |
Correct |
31 ms |
6300 KB |
Output is correct |
53 |
Correct |
32 ms |
6364 KB |
Output is correct |
54 |
Correct |
34 ms |
6256 KB |
Output is correct |
55 |
Correct |
31 ms |
6316 KB |
Output is correct |
56 |
Correct |
31 ms |
6352 KB |
Output is correct |
57 |
Correct |
31 ms |
6268 KB |
Output is correct |
58 |
Correct |
31 ms |
6356 KB |
Output is correct |
59 |
Correct |
31 ms |
6240 KB |
Output is correct |
60 |
Correct |
31 ms |
6300 KB |
Output is correct |
61 |
Correct |
31 ms |
6348 KB |
Output is correct |
62 |
Correct |
30 ms |
6240 KB |
Output is correct |
63 |
Correct |
31 ms |
6284 KB |
Output is correct |
64 |
Correct |
35 ms |
6400 KB |
Output is correct |
65 |
Correct |
31 ms |
6312 KB |
Output is correct |
66 |
Correct |
31 ms |
6296 KB |
Output is correct |
67 |
Correct |
31 ms |
6256 KB |
Output is correct |
68 |
Correct |
31 ms |
6288 KB |
Output is correct |
69 |
Correct |
31 ms |
6308 KB |
Output is correct |
70 |
Correct |
30 ms |
6348 KB |
Output is correct |
71 |
Correct |
8 ms |
3540 KB |
Output is correct |
72 |
Correct |
8 ms |
3540 KB |
Output is correct |
73 |
Correct |
8 ms |
3496 KB |
Output is correct |
74 |
Correct |
8 ms |
3516 KB |
Output is correct |
75 |
Correct |
9 ms |
3540 KB |
Output is correct |
76 |
Correct |
16 ms |
4388 KB |
Output is correct |
77 |
Correct |
16 ms |
4468 KB |
Output is correct |
78 |
Correct |
17 ms |
4428 KB |
Output is correct |
79 |
Correct |
16 ms |
4432 KB |
Output is correct |
80 |
Correct |
16 ms |
4384 KB |
Output is correct |
81 |
Correct |
34 ms |
6096 KB |
Output is correct |
82 |
Correct |
33 ms |
6084 KB |
Output is correct |
83 |
Correct |
34 ms |
6068 KB |
Output is correct |
84 |
Correct |
33 ms |
6028 KB |
Output is correct |
85 |
Correct |
33 ms |
6112 KB |
Output is correct |
86 |
Correct |
40 ms |
6864 KB |
Output is correct |
87 |
Correct |
40 ms |
6956 KB |
Output is correct |
88 |
Correct |
40 ms |
6864 KB |
Output is correct |
89 |
Correct |
40 ms |
6936 KB |
Output is correct |
90 |
Correct |
40 ms |
6840 KB |
Output is correct |
91 |
Correct |
90 ms |
14092 KB |
Output is correct |
92 |
Correct |
90 ms |
14104 KB |
Output is correct |
93 |
Correct |
101 ms |
14100 KB |
Output is correct |
94 |
Correct |
94 ms |
14032 KB |
Output is correct |
95 |
Correct |
91 ms |
13988 KB |
Output is correct |
96 |
Correct |
137 ms |
21308 KB |
Output is correct |
97 |
Correct |
126 ms |
21308 KB |
Output is correct |
98 |
Correct |
128 ms |
21396 KB |
Output is correct |
99 |
Correct |
122 ms |
21376 KB |
Output is correct |
100 |
Correct |
124 ms |
21380 KB |
Output is correct |
101 |
Correct |
124 ms |
21400 KB |
Output is correct |
102 |
Correct |
136 ms |
21292 KB |
Output is correct |
103 |
Correct |
130 ms |
21360 KB |
Output is correct |
104 |
Correct |
125 ms |
21404 KB |
Output is correct |
105 |
Correct |
124 ms |
21288 KB |
Output is correct |
106 |
Correct |
163 ms |
25184 KB |
Output is correct |
107 |
Correct |
144 ms |
24992 KB |
Output is correct |
108 |
Correct |
141 ms |
25016 KB |
Output is correct |
109 |
Correct |
139 ms |
24988 KB |
Output is correct |
110 |
Correct |
168 ms |
24980 KB |
Output is correct |
111 |
Correct |
142 ms |
24888 KB |
Output is correct |
112 |
Correct |
143 ms |
24952 KB |
Output is correct |
113 |
Correct |
139 ms |
24980 KB |
Output is correct |
114 |
Correct |
150 ms |
24968 KB |
Output is correct |
115 |
Correct |
141 ms |
24948 KB |
Output is correct |
116 |
Correct |
257 ms |
6224 KB |
Output is correct |
117 |
Correct |
466 ms |
6220 KB |
Output is correct |
118 |
Correct |
498 ms |
6864 KB |
Output is correct |
119 |
Correct |
2255 ms |
6940 KB |
Output is correct |
120 |
Correct |
3643 ms |
7000 KB |
Output is correct |
121 |
Correct |
3887 ms |
7596 KB |
Output is correct |
122 |
Correct |
3945 ms |
7716 KB |
Output is correct |
123 |
Correct |
4136 ms |
8940 KB |
Output is correct |
124 |
Correct |
4395 ms |
9460 KB |
Output is correct |
125 |
Correct |
4086 ms |
9772 KB |
Output is correct |
126 |
Correct |
1750 ms |
9920 KB |
Output is correct |
127 |
Correct |
1752 ms |
9860 KB |
Output is correct |
128 |
Correct |
1764 ms |
9884 KB |
Output is correct |
129 |
Correct |
1763 ms |
9852 KB |
Output is correct |
130 |
Correct |
1750 ms |
9848 KB |
Output is correct |
131 |
Correct |
2706 ms |
10028 KB |
Output is correct |
132 |
Correct |
2719 ms |
10036 KB |
Output is correct |
133 |
Correct |
2712 ms |
10020 KB |
Output is correct |
134 |
Correct |
2733 ms |
10028 KB |
Output is correct |
135 |
Correct |
2701 ms |
10036 KB |
Output is correct |
136 |
Correct |
2710 ms |
9920 KB |
Output is correct |
137 |
Correct |
2705 ms |
10052 KB |
Output is correct |
138 |
Correct |
2728 ms |
10024 KB |
Output is correct |
139 |
Correct |
2728 ms |
10032 KB |
Output is correct |
140 |
Correct |
2724 ms |
10048 KB |
Output is correct |
141 |
Correct |
4392 ms |
10104 KB |
Output is correct |
142 |
Correct |
4372 ms |
10104 KB |
Output is correct |
143 |
Correct |
4381 ms |
10116 KB |
Output is correct |
144 |
Correct |
4398 ms |
10116 KB |
Output is correct |
145 |
Correct |
4390 ms |
10104 KB |
Output is correct |
146 |
Correct |
5078 ms |
10736 KB |
Output is correct |
147 |
Correct |
5131 ms |
10732 KB |
Output is correct |
148 |
Correct |
5073 ms |
10720 KB |
Output is correct |
149 |
Correct |
5039 ms |
10848 KB |
Output is correct |
150 |
Correct |
5039 ms |
10856 KB |
Output is correct |
151 |
Correct |
4699 ms |
11076 KB |
Output is correct |
152 |
Correct |
4614 ms |
11092 KB |
Output is correct |
153 |
Correct |
4624 ms |
11040 KB |
Output is correct |
154 |
Correct |
4618 ms |
11120 KB |
Output is correct |
155 |
Correct |
4631 ms |
11040 KB |
Output is correct |
156 |
Correct |
4843 ms |
14864 KB |
Output is correct |
157 |
Correct |
4869 ms |
14864 KB |
Output is correct |
158 |
Correct |
4897 ms |
14868 KB |
Output is correct |
159 |
Correct |
4879 ms |
14864 KB |
Output is correct |
160 |
Correct |
4885 ms |
14840 KB |
Output is correct |
161 |
Correct |
4518 ms |
13120 KB |
Output is correct |
162 |
Correct |
4512 ms |
13116 KB |
Output is correct |
163 |
Correct |
4523 ms |
13116 KB |
Output is correct |
164 |
Correct |
4542 ms |
13224 KB |
Output is correct |
165 |
Correct |
4543 ms |
13112 KB |
Output is correct |
166 |
Correct |
4325 ms |
10592 KB |
Output is correct |
167 |
Correct |
4330 ms |
10592 KB |
Output is correct |
168 |
Correct |
4342 ms |
10604 KB |
Output is correct |
169 |
Correct |
4318 ms |
10592 KB |
Output is correct |
170 |
Correct |
4318 ms |
10588 KB |
Output is correct |
171 |
Correct |
2433 ms |
10548 KB |
Output is correct |
172 |
Correct |
2422 ms |
10560 KB |
Output is correct |
173 |
Correct |
2417 ms |
10460 KB |
Output is correct |
174 |
Correct |
2430 ms |
10460 KB |
Output is correct |
175 |
Correct |
2418 ms |
10564 KB |
Output is correct |