Submission #783821

# Submission time Handle Problem Language Result Execution time Memory
783821 2023-07-15T11:04:42 Z Deepesson Diversity (CEOI21_diversity) C++17
100 / 100
5139 ms 25004 KB
#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;
      |                     ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2732 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2732 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2712 KB Output is correct
9 Correct 2 ms 2772 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2732 KB Output is correct
2 Correct 2 ms 2772 KB Output is correct
3 Correct 3 ms 2744 KB Output is correct
4 Correct 7 ms 3668 KB Output is correct
5 Correct 13 ms 4692 KB Output is correct
6 Correct 21 ms 5720 KB Output is correct
7 Correct 17 ms 5628 KB Output is correct
8 Correct 18 ms 5716 KB Output is correct
9 Correct 19 ms 5688 KB Output is correct
10 Correct 19 ms 5700 KB Output is correct
11 Correct 19 ms 5752 KB Output is correct
12 Correct 18 ms 5680 KB Output is correct
13 Correct 18 ms 5692 KB Output is correct
14 Correct 18 ms 5716 KB Output is correct
15 Correct 19 ms 5680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2732 KB Output is correct
2 Correct 2 ms 2772 KB Output is correct
3 Correct 3 ms 2744 KB Output is correct
4 Correct 7 ms 3668 KB Output is correct
5 Correct 13 ms 4692 KB Output is correct
6 Correct 21 ms 5720 KB Output is correct
7 Correct 17 ms 5628 KB Output is correct
8 Correct 18 ms 5716 KB Output is correct
9 Correct 19 ms 5688 KB Output is correct
10 Correct 19 ms 5700 KB Output is correct
11 Correct 19 ms 5752 KB Output is correct
12 Correct 18 ms 5680 KB Output is correct
13 Correct 18 ms 5692 KB Output is correct
14 Correct 18 ms 5716 KB Output is correct
15 Correct 19 ms 5680 KB Output is correct
16 Correct 2 ms 2772 KB Output is correct
17 Correct 2 ms 2772 KB Output is correct
18 Correct 3 ms 2876 KB Output is correct
19 Correct 8 ms 3708 KB Output is correct
20 Correct 14 ms 4796 KB Output is correct
21 Correct 20 ms 5808 KB Output is correct
22 Correct 24 ms 5796 KB Output is correct
23 Correct 22 ms 5828 KB Output is correct
24 Correct 21 ms 5852 KB Output is correct
25 Correct 21 ms 5860 KB Output is correct
26 Correct 22 ms 5792 KB Output is correct
27 Correct 23 ms 5856 KB Output is correct
28 Correct 20 ms 5756 KB Output is correct
29 Correct 23 ms 5800 KB Output is correct
30 Correct 21 ms 5784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2732 KB Output is correct
2 Correct 2 ms 2772 KB Output is correct
3 Correct 3 ms 2744 KB Output is correct
4 Correct 7 ms 3668 KB Output is correct
5 Correct 13 ms 4692 KB Output is correct
6 Correct 21 ms 5720 KB Output is correct
7 Correct 17 ms 5628 KB Output is correct
8 Correct 18 ms 5716 KB Output is correct
9 Correct 19 ms 5688 KB Output is correct
10 Correct 19 ms 5700 KB Output is correct
11 Correct 19 ms 5752 KB Output is correct
12 Correct 18 ms 5680 KB Output is correct
13 Correct 18 ms 5692 KB Output is correct
14 Correct 18 ms 5716 KB Output is correct
15 Correct 19 ms 5680 KB Output is correct
16 Correct 2 ms 2772 KB Output is correct
17 Correct 2 ms 2772 KB Output is correct
18 Correct 3 ms 2876 KB Output is correct
19 Correct 8 ms 3708 KB Output is correct
20 Correct 14 ms 4796 KB Output is correct
21 Correct 20 ms 5808 KB Output is correct
22 Correct 24 ms 5796 KB Output is correct
23 Correct 22 ms 5828 KB Output is correct
24 Correct 21 ms 5852 KB Output is correct
25 Correct 21 ms 5860 KB Output is correct
26 Correct 22 ms 5792 KB Output is correct
27 Correct 23 ms 5856 KB Output is correct
28 Correct 20 ms 5756 KB Output is correct
29 Correct 23 ms 5800 KB Output is correct
30 Correct 21 ms 5784 KB Output is correct
31 Correct 2 ms 2772 KB Output is correct
32 Correct 3 ms 2772 KB Output is correct
33 Correct 3 ms 2740 KB Output is correct
34 Correct 3 ms 2772 KB Output is correct
35 Correct 3 ms 2900 KB Output is correct
36 Correct 3 ms 3004 KB Output is correct
37 Correct 8 ms 3412 KB Output is correct
38 Correct 7 ms 3412 KB Output is correct
39 Correct 15 ms 4028 KB Output is correct
40 Correct 22 ms 5204 KB Output is correct
41 Correct 31 ms 6360 KB Output is correct
42 Correct 31 ms 6320 KB Output is correct
43 Correct 31 ms 6368 KB Output is correct
44 Correct 31 ms 6284 KB Output is correct
45 Correct 31 ms 6284 KB Output is correct
46 Correct 31 ms 6252 KB Output is correct
47 Correct 31 ms 6308 KB Output is correct
48 Correct 31 ms 6360 KB Output is correct
49 Correct 35 ms 6464 KB Output is correct
50 Correct 32 ms 6248 KB Output is correct
51 Correct 31 ms 6332 KB Output is correct
52 Correct 32 ms 6304 KB Output is correct
53 Correct 37 ms 6296 KB Output is correct
54 Correct 31 ms 6356 KB Output is correct
55 Correct 31 ms 6272 KB Output is correct
56 Correct 32 ms 6336 KB Output is correct
57 Correct 35 ms 6348 KB Output is correct
58 Correct 31 ms 6304 KB Output is correct
59 Correct 31 ms 6292 KB Output is correct
60 Correct 32 ms 6312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2732 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2732 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2712 KB Output is correct
9 Correct 2 ms 2772 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2732 KB Output is correct
12 Correct 2 ms 2772 KB Output is correct
13 Correct 3 ms 2744 KB Output is correct
14 Correct 7 ms 3668 KB Output is correct
15 Correct 13 ms 4692 KB Output is correct
16 Correct 21 ms 5720 KB Output is correct
17 Correct 17 ms 5628 KB Output is correct
18 Correct 18 ms 5716 KB Output is correct
19 Correct 19 ms 5688 KB Output is correct
20 Correct 19 ms 5700 KB Output is correct
21 Correct 19 ms 5752 KB Output is correct
22 Correct 18 ms 5680 KB Output is correct
23 Correct 18 ms 5692 KB Output is correct
24 Correct 18 ms 5716 KB Output is correct
25 Correct 19 ms 5680 KB Output is correct
26 Correct 2 ms 2772 KB Output is correct
27 Correct 2 ms 2772 KB Output is correct
28 Correct 3 ms 2876 KB Output is correct
29 Correct 8 ms 3708 KB Output is correct
30 Correct 14 ms 4796 KB Output is correct
31 Correct 20 ms 5808 KB Output is correct
32 Correct 24 ms 5796 KB Output is correct
33 Correct 22 ms 5828 KB Output is correct
34 Correct 21 ms 5852 KB Output is correct
35 Correct 21 ms 5860 KB Output is correct
36 Correct 22 ms 5792 KB Output is correct
37 Correct 23 ms 5856 KB Output is correct
38 Correct 20 ms 5756 KB Output is correct
39 Correct 23 ms 5800 KB Output is correct
40 Correct 21 ms 5784 KB Output is correct
41 Correct 2 ms 2772 KB Output is correct
42 Correct 3 ms 2772 KB Output is correct
43 Correct 3 ms 2740 KB Output is correct
44 Correct 3 ms 2772 KB Output is correct
45 Correct 3 ms 2900 KB Output is correct
46 Correct 3 ms 3004 KB Output is correct
47 Correct 8 ms 3412 KB Output is correct
48 Correct 7 ms 3412 KB Output is correct
49 Correct 15 ms 4028 KB Output is correct
50 Correct 22 ms 5204 KB Output is correct
51 Correct 31 ms 6360 KB Output is correct
52 Correct 31 ms 6320 KB Output is correct
53 Correct 31 ms 6368 KB Output is correct
54 Correct 31 ms 6284 KB Output is correct
55 Correct 31 ms 6284 KB Output is correct
56 Correct 31 ms 6252 KB Output is correct
57 Correct 31 ms 6308 KB Output is correct
58 Correct 31 ms 6360 KB Output is correct
59 Correct 35 ms 6464 KB Output is correct
60 Correct 32 ms 6248 KB Output is correct
61 Correct 31 ms 6332 KB Output is correct
62 Correct 32 ms 6304 KB Output is correct
63 Correct 37 ms 6296 KB Output is correct
64 Correct 31 ms 6356 KB Output is correct
65 Correct 31 ms 6272 KB Output is correct
66 Correct 32 ms 6336 KB Output is correct
67 Correct 35 ms 6348 KB Output is correct
68 Correct 31 ms 6304 KB Output is correct
69 Correct 31 ms 6292 KB Output is correct
70 Correct 32 ms 6312 KB Output is correct
71 Correct 9 ms 3516 KB Output is correct
72 Correct 8 ms 3540 KB Output is correct
73 Correct 8 ms 3576 KB Output is correct
74 Correct 8 ms 3488 KB Output is correct
75 Correct 8 ms 3496 KB Output is correct
76 Correct 16 ms 4384 KB Output is correct
77 Correct 17 ms 4356 KB Output is correct
78 Correct 16 ms 4476 KB Output is correct
79 Correct 16 ms 4436 KB Output is correct
80 Correct 17 ms 4364 KB Output is correct
81 Correct 34 ms 6248 KB Output is correct
82 Correct 33 ms 6056 KB Output is correct
83 Correct 34 ms 6120 KB Output is correct
84 Correct 33 ms 6020 KB Output is correct
85 Correct 34 ms 6088 KB Output is correct
86 Correct 51 ms 6896 KB Output is correct
87 Correct 41 ms 6848 KB Output is correct
88 Correct 41 ms 6932 KB Output is correct
89 Correct 42 ms 6864 KB Output is correct
90 Correct 41 ms 6912 KB Output is correct
91 Correct 90 ms 14104 KB Output is correct
92 Correct 91 ms 14012 KB Output is correct
93 Correct 90 ms 13984 KB Output is correct
94 Correct 89 ms 14040 KB Output is correct
95 Correct 92 ms 13984 KB Output is correct
96 Correct 121 ms 21324 KB Output is correct
97 Correct 155 ms 21400 KB Output is correct
98 Correct 131 ms 21312 KB Output is correct
99 Correct 142 ms 21376 KB Output is correct
100 Correct 149 ms 21332 KB Output is correct
101 Correct 124 ms 21312 KB Output is correct
102 Correct 156 ms 21344 KB Output is correct
103 Correct 141 ms 21308 KB Output is correct
104 Correct 123 ms 21404 KB Output is correct
105 Correct 126 ms 21308 KB Output is correct
106 Correct 145 ms 24976 KB Output is correct
107 Correct 152 ms 25004 KB Output is correct
108 Correct 148 ms 24892 KB Output is correct
109 Correct 143 ms 24908 KB Output is correct
110 Correct 143 ms 24928 KB Output is correct
111 Correct 154 ms 24896 KB Output is correct
112 Correct 170 ms 24884 KB Output is correct
113 Correct 150 ms 24992 KB Output is correct
114 Correct 144 ms 24992 KB Output is correct
115 Correct 154 ms 24972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2732 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2732 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 2 ms 2712 KB Output is correct
9 Correct 2 ms 2772 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 2 ms 2732 KB Output is correct
12 Correct 2 ms 2772 KB Output is correct
13 Correct 3 ms 2744 KB Output is correct
14 Correct 7 ms 3668 KB Output is correct
15 Correct 13 ms 4692 KB Output is correct
16 Correct 21 ms 5720 KB Output is correct
17 Correct 17 ms 5628 KB Output is correct
18 Correct 18 ms 5716 KB Output is correct
19 Correct 19 ms 5688 KB Output is correct
20 Correct 19 ms 5700 KB Output is correct
21 Correct 19 ms 5752 KB Output is correct
22 Correct 18 ms 5680 KB Output is correct
23 Correct 18 ms 5692 KB Output is correct
24 Correct 18 ms 5716 KB Output is correct
25 Correct 19 ms 5680 KB Output is correct
26 Correct 2 ms 2772 KB Output is correct
27 Correct 2 ms 2772 KB Output is correct
28 Correct 3 ms 2876 KB Output is correct
29 Correct 8 ms 3708 KB Output is correct
30 Correct 14 ms 4796 KB Output is correct
31 Correct 20 ms 5808 KB Output is correct
32 Correct 24 ms 5796 KB Output is correct
33 Correct 22 ms 5828 KB Output is correct
34 Correct 21 ms 5852 KB Output is correct
35 Correct 21 ms 5860 KB Output is correct
36 Correct 22 ms 5792 KB Output is correct
37 Correct 23 ms 5856 KB Output is correct
38 Correct 20 ms 5756 KB Output is correct
39 Correct 23 ms 5800 KB Output is correct
40 Correct 21 ms 5784 KB Output is correct
41 Correct 2 ms 2772 KB Output is correct
42 Correct 3 ms 2772 KB Output is correct
43 Correct 3 ms 2740 KB Output is correct
44 Correct 3 ms 2772 KB Output is correct
45 Correct 3 ms 2900 KB Output is correct
46 Correct 3 ms 3004 KB Output is correct
47 Correct 8 ms 3412 KB Output is correct
48 Correct 7 ms 3412 KB Output is correct
49 Correct 15 ms 4028 KB Output is correct
50 Correct 22 ms 5204 KB Output is correct
51 Correct 31 ms 6360 KB Output is correct
52 Correct 31 ms 6320 KB Output is correct
53 Correct 31 ms 6368 KB Output is correct
54 Correct 31 ms 6284 KB Output is correct
55 Correct 31 ms 6284 KB Output is correct
56 Correct 31 ms 6252 KB Output is correct
57 Correct 31 ms 6308 KB Output is correct
58 Correct 31 ms 6360 KB Output is correct
59 Correct 35 ms 6464 KB Output is correct
60 Correct 32 ms 6248 KB Output is correct
61 Correct 31 ms 6332 KB Output is correct
62 Correct 32 ms 6304 KB Output is correct
63 Correct 37 ms 6296 KB Output is correct
64 Correct 31 ms 6356 KB Output is correct
65 Correct 31 ms 6272 KB Output is correct
66 Correct 32 ms 6336 KB Output is correct
67 Correct 35 ms 6348 KB Output is correct
68 Correct 31 ms 6304 KB Output is correct
69 Correct 31 ms 6292 KB Output is correct
70 Correct 32 ms 6312 KB Output is correct
71 Correct 9 ms 3516 KB Output is correct
72 Correct 8 ms 3540 KB Output is correct
73 Correct 8 ms 3576 KB Output is correct
74 Correct 8 ms 3488 KB Output is correct
75 Correct 8 ms 3496 KB Output is correct
76 Correct 16 ms 4384 KB Output is correct
77 Correct 17 ms 4356 KB Output is correct
78 Correct 16 ms 4476 KB Output is correct
79 Correct 16 ms 4436 KB Output is correct
80 Correct 17 ms 4364 KB Output is correct
81 Correct 34 ms 6248 KB Output is correct
82 Correct 33 ms 6056 KB Output is correct
83 Correct 34 ms 6120 KB Output is correct
84 Correct 33 ms 6020 KB Output is correct
85 Correct 34 ms 6088 KB Output is correct
86 Correct 51 ms 6896 KB Output is correct
87 Correct 41 ms 6848 KB Output is correct
88 Correct 41 ms 6932 KB Output is correct
89 Correct 42 ms 6864 KB Output is correct
90 Correct 41 ms 6912 KB Output is correct
91 Correct 90 ms 14104 KB Output is correct
92 Correct 91 ms 14012 KB Output is correct
93 Correct 90 ms 13984 KB Output is correct
94 Correct 89 ms 14040 KB Output is correct
95 Correct 92 ms 13984 KB Output is correct
96 Correct 121 ms 21324 KB Output is correct
97 Correct 155 ms 21400 KB Output is correct
98 Correct 131 ms 21312 KB Output is correct
99 Correct 142 ms 21376 KB Output is correct
100 Correct 149 ms 21332 KB Output is correct
101 Correct 124 ms 21312 KB Output is correct
102 Correct 156 ms 21344 KB Output is correct
103 Correct 141 ms 21308 KB Output is correct
104 Correct 123 ms 21404 KB Output is correct
105 Correct 126 ms 21308 KB Output is correct
106 Correct 145 ms 24976 KB Output is correct
107 Correct 152 ms 25004 KB Output is correct
108 Correct 148 ms 24892 KB Output is correct
109 Correct 143 ms 24908 KB Output is correct
110 Correct 143 ms 24928 KB Output is correct
111 Correct 154 ms 24896 KB Output is correct
112 Correct 170 ms 24884 KB Output is correct
113 Correct 150 ms 24992 KB Output is correct
114 Correct 144 ms 24992 KB Output is correct
115 Correct 154 ms 24972 KB Output is correct
116 Correct 271 ms 6224 KB Output is correct
117 Correct 476 ms 6224 KB Output is correct
118 Correct 505 ms 6856 KB Output is correct
119 Correct 2308 ms 6944 KB Output is correct
120 Correct 3745 ms 7000 KB Output is correct
121 Correct 3945 ms 7596 KB Output is correct
122 Correct 3957 ms 7720 KB Output is correct
123 Correct 4227 ms 9032 KB Output is correct
124 Correct 4470 ms 9460 KB Output is correct
125 Correct 4206 ms 9772 KB Output is correct
126 Correct 1797 ms 9856 KB Output is correct
127 Correct 1815 ms 9856 KB Output is correct
128 Correct 1786 ms 9840 KB Output is correct
129 Correct 1776 ms 9964 KB Output is correct
130 Correct 1807 ms 9840 KB Output is correct
131 Correct 2786 ms 10024 KB Output is correct
132 Correct 2798 ms 10032 KB Output is correct
133 Correct 2735 ms 10016 KB Output is correct
134 Correct 2750 ms 10020 KB Output is correct
135 Correct 2783 ms 10036 KB Output is correct
136 Correct 2782 ms 10024 KB Output is correct
137 Correct 2794 ms 10048 KB Output is correct
138 Correct 2826 ms 10028 KB Output is correct
139 Correct 2781 ms 10020 KB Output is correct
140 Correct 2811 ms 10020 KB Output is correct
141 Correct 4522 ms 10112 KB Output is correct
142 Correct 4531 ms 10120 KB Output is correct
143 Correct 4492 ms 10108 KB Output is correct
144 Correct 4505 ms 10184 KB Output is correct
145 Correct 4479 ms 10108 KB Output is correct
146 Correct 5097 ms 10724 KB Output is correct
147 Correct 5100 ms 10748 KB Output is correct
148 Correct 5107 ms 10724 KB Output is correct
149 Correct 5139 ms 10736 KB Output is correct
150 Correct 5134 ms 10720 KB Output is correct
151 Correct 4705 ms 11044 KB Output is correct
152 Correct 4702 ms 11032 KB Output is correct
153 Correct 4744 ms 11032 KB Output is correct
154 Correct 4728 ms 11036 KB Output is correct
155 Correct 4815 ms 11032 KB Output is correct
156 Correct 4928 ms 14852 KB Output is correct
157 Correct 4954 ms 14904 KB Output is correct
158 Correct 4953 ms 14860 KB Output is correct
159 Correct 4953 ms 14856 KB Output is correct
160 Correct 5046 ms 14852 KB Output is correct
161 Correct 4558 ms 13100 KB Output is correct
162 Correct 4546 ms 13108 KB Output is correct
163 Correct 4602 ms 13104 KB Output is correct
164 Correct 4634 ms 13100 KB Output is correct
165 Correct 4600 ms 13228 KB Output is correct
166 Correct 4489 ms 10588 KB Output is correct
167 Correct 4418 ms 10580 KB Output is correct
168 Correct 4428 ms 10584 KB Output is correct
169 Correct 4462 ms 10584 KB Output is correct
170 Correct 4467 ms 10584 KB Output is correct
171 Correct 2510 ms 10452 KB Output is correct
172 Correct 2527 ms 10464 KB Output is correct
173 Correct 2519 ms 10464 KB Output is correct
174 Correct 2481 ms 10460 KB Output is correct
175 Correct 2553 ms 10472 KB Output is correct