#include "paint.h"
#include <bits/stdc++.h>
#define MAX 100004
typedef std::pair<int,int> pii;
int pai1[MAX][633];
short pai2[MAX][633];
int mod(int p,int M){
p%=M;
if(p<0)p+=M;
return p;
}
pii find(pii x){
auto&ref1 = pai1[x.first][x.second];
short&ref2 = pai2[x.first][x.second];
if(ref1==x.first&&ref2==x.second)
return x;
auto ans = find({ref1,ref2});
ref1=ans.first;
ref2=ans.second;
return ans;
}
void Union(pii a,pii b){
a=find(a);
b=find(b);
if(a!=b){
/// auto& ref1 = size[a],ref2=size[b];
/// if(ref1>ref2)std::swap(a,b);
pai1[a.first][a.second]=b.first;
pai2[a.first][a.second]=b.second;
/// ref1+=ref2;
}
}
bool pode[MAX];
std::vector<int> curte[MAX];
int get_num(int pos,int val){
int l=0,r=curte[pos].size()-1;
if(r<l)return -1;
int obj = val;
while(l<r){
int m = (l+r+1)/2;
if(curte[pos][m]>obj){
r=m-1;
}else l=m;
}
if(l<0)return -1;
/// std::cout<<pos<<" "<<l<<"\n";
if(curte[pos][l]==val)return l;
return -1;
}
int minimumInstructions(int N, int M, int K, std::vector<int> C, std::vector<int> A, std::vector<std::vector<int>> B) {
for(int i=0;i!=MAX;++i){
for(int j=0;j!=633;++j){
pai1[i][j]=i;
pai2[i][j]=j;
}
}
for(int i=0;i!=M;++i){
for(auto& x:B[i]){
curte[x].push_back(i);
}
}
std::vector<int> ordem;
for(int i=0;i!=N-1;++i)ordem.push_back(i);
std::random_shuffle(ordem.begin(),ordem.end());
for(auto&ka:ordem){
int i=ka;
int cor1 = C[i],cor2 = C[i+1];
for(int j=0;j!=curte[cor1].size();++j){
auto x=curte[cor1][j];
int tipo = x,prox = mod(x+1,M);
bool ok=false;
/// std::cout<<"Tentando "<<j<<" "<<i<<"\n";
int ans;
{
int l=0,r=curte[cor2].size()-1;
if(r<l)break;
int obj = prox;
while(l<r){
int m = (l+r+1)/2;
if(curte[cor2][m]>obj){
r=m-1;
}else l=m;
}
if(curte[cor2][l]==obj)ok=true;
ans=l;
}
/// std::cout<<"Tentou\n";
if(ok)
{
Union({i,j},{i+1,ans});
/// std::cout<<"Liga "<<i<<" "<<j<<" com: "<<i+1<<" "<<ans<<"\n";
}
}
}
for(int i=0;i!=N;++i){
int fim = i+M-1;
if(fim>=N)break;
/// std::cout<<"Checa "<<i<<"\n";
for(int j=0;j!=curte[C[i]].size();++j){
auto x=curte[C[i]][j];
int ultimo_pintor = mod(x-1,M);
int ind1 = j,ind2 = get_num(C[fim],ultimo_pintor);
/// std::cout<<"Ind "<<ind2<<"\n";
if(ind2==-1)continue;
pii alpha = find({i,ind1});
pii beta = find({fim,ind2});
/// std::cout<<"Busca "<<i<<" "<<ind1<<" "<<fim<<" "<<ind2<<"\n";
///std::cout<<alpha.first<<" "<<alpha.second<<" "<<beta.first<<" "<<beta.second<<"!\n";
if(alpha==beta){
/// std::cout<<"Conexao "<<i<<" "<<fim<<"\n";
pode[i]=true;
break;
}
}
}
std::priority_queue<pii,std::vector<pii>,std::greater<pii>> queue;
int min = 1e9;
int last=0;
for(int i=0;i!=N+1;++i){
int ans=1e9;
if(i){
while(queue.size()){
auto __ = queue.top();
///Invalido
if(__.second<i-M){
queue.pop();
continue;
}
ans=__.first;
break;
}
}else ans=0;
if(pode[i])
queue.push({ans+1,i});
/// std::cout<<"Custo "<<ans<<" ("<<i<<")\n";
last=ans;
}
if(last>=1e9)return -1;
///Sucesso
return last;
}
Compilation message
paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:70:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
70 | for(int j=0;j!=curte[cor1].size();++j){
| ~^~~~~~~~~~~~~~~~~~~~
paint.cpp:72:17: warning: unused variable 'tipo' [-Wunused-variable]
72 | int tipo = x,prox = mod(x+1,M);
| ^~~~
paint.cpp:102:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
102 | for(int j=0;j!=curte[C[i]].size();++j){
| ~^~~~~~~~~~~~~~~~~~~~
paint.cpp:122:9: warning: unused variable 'min' [-Wunused-variable]
122 | int min = 1e9;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
374264 KB |
Output is correct |
2 |
Correct |
200 ms |
374224 KB |
Output is correct |
3 |
Correct |
201 ms |
374236 KB |
Output is correct |
4 |
Correct |
203 ms |
374244 KB |
Output is correct |
5 |
Correct |
204 ms |
374304 KB |
Output is correct |
6 |
Correct |
202 ms |
374284 KB |
Output is correct |
7 |
Correct |
200 ms |
374196 KB |
Output is correct |
8 |
Correct |
201 ms |
374184 KB |
Output is correct |
9 |
Correct |
201 ms |
374220 KB |
Output is correct |
10 |
Correct |
203 ms |
374272 KB |
Output is correct |
11 |
Correct |
200 ms |
374288 KB |
Output is correct |
12 |
Correct |
202 ms |
374292 KB |
Output is correct |
13 |
Correct |
207 ms |
374252 KB |
Output is correct |
14 |
Correct |
204 ms |
374308 KB |
Output is correct |
15 |
Correct |
203 ms |
374232 KB |
Output is correct |
16 |
Correct |
203 ms |
374216 KB |
Output is correct |
17 |
Correct |
201 ms |
374200 KB |
Output is correct |
18 |
Correct |
199 ms |
374228 KB |
Output is correct |
19 |
Correct |
205 ms |
374432 KB |
Output is correct |
20 |
Correct |
201 ms |
374340 KB |
Output is correct |
21 |
Correct |
204 ms |
374236 KB |
Output is correct |
22 |
Correct |
218 ms |
378144 KB |
Output is correct |
23 |
Correct |
217 ms |
378204 KB |
Output is correct |
24 |
Correct |
215 ms |
378176 KB |
Output is correct |
25 |
Correct |
206 ms |
374864 KB |
Output is correct |
26 |
Correct |
211 ms |
374588 KB |
Output is correct |
27 |
Correct |
208 ms |
374656 KB |
Output is correct |
28 |
Correct |
210 ms |
374656 KB |
Output is correct |
29 |
Correct |
208 ms |
374608 KB |
Output is correct |
30 |
Correct |
216 ms |
374592 KB |
Output is correct |
31 |
Correct |
217 ms |
375500 KB |
Output is correct |
32 |
Correct |
227 ms |
375472 KB |
Output is correct |
33 |
Correct |
217 ms |
375460 KB |
Output is correct |
34 |
Correct |
214 ms |
375564 KB |
Output is correct |
35 |
Correct |
215 ms |
375556 KB |
Output is correct |
36 |
Correct |
214 ms |
375580 KB |
Output is correct |
37 |
Correct |
221 ms |
378736 KB |
Output is correct |
38 |
Correct |
225 ms |
378616 KB |
Output is correct |
39 |
Correct |
226 ms |
378704 KB |
Output is correct |
40 |
Correct |
238 ms |
375676 KB |
Output is correct |
41 |
Correct |
224 ms |
375104 KB |
Output is correct |
42 |
Correct |
224 ms |
375612 KB |
Output is correct |
43 |
Correct |
217 ms |
375128 KB |
Output is correct |
44 |
Correct |
213 ms |
375144 KB |
Output is correct |
45 |
Correct |
218 ms |
375624 KB |
Output is correct |
46 |
Correct |
262 ms |
384588 KB |
Output is correct |
47 |
Correct |
249 ms |
379848 KB |
Output is correct |
48 |
Correct |
243 ms |
382228 KB |
Output is correct |
49 |
Correct |
236 ms |
382372 KB |
Output is correct |
50 |
Correct |
232 ms |
382288 KB |
Output is correct |
51 |
Correct |
227 ms |
379984 KB |
Output is correct |
52 |
Correct |
245 ms |
375804 KB |
Output is correct |
53 |
Correct |
241 ms |
375684 KB |
Output is correct |
54 |
Correct |
231 ms |
375620 KB |
Output is correct |
55 |
Correct |
225 ms |
375704 KB |
Output is correct |
56 |
Correct |
222 ms |
375696 KB |
Output is correct |
57 |
Correct |
226 ms |
375652 KB |
Output is correct |
58 |
Correct |
288 ms |
385288 KB |
Output is correct |
59 |
Correct |
302 ms |
385280 KB |
Output is correct |
60 |
Correct |
287 ms |
385284 KB |
Output is correct |
61 |
Correct |
305 ms |
385224 KB |
Output is correct |
62 |
Correct |
293 ms |
385244 KB |
Output is correct |
63 |
Correct |
288 ms |
385220 KB |
Output is correct |
64 |
Correct |
268 ms |
383956 KB |
Output is correct |
65 |
Correct |
269 ms |
383904 KB |
Output is correct |
66 |
Correct |
281 ms |
383828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
196 ms |
374264 KB |
Output is correct |
2 |
Correct |
200 ms |
374224 KB |
Output is correct |
3 |
Correct |
201 ms |
374236 KB |
Output is correct |
4 |
Correct |
203 ms |
374244 KB |
Output is correct |
5 |
Correct |
204 ms |
374304 KB |
Output is correct |
6 |
Correct |
202 ms |
374284 KB |
Output is correct |
7 |
Correct |
200 ms |
374196 KB |
Output is correct |
8 |
Correct |
201 ms |
374184 KB |
Output is correct |
9 |
Correct |
201 ms |
374220 KB |
Output is correct |
10 |
Correct |
203 ms |
374272 KB |
Output is correct |
11 |
Correct |
200 ms |
374288 KB |
Output is correct |
12 |
Correct |
202 ms |
374292 KB |
Output is correct |
13 |
Correct |
207 ms |
374252 KB |
Output is correct |
14 |
Correct |
204 ms |
374308 KB |
Output is correct |
15 |
Correct |
203 ms |
374232 KB |
Output is correct |
16 |
Correct |
203 ms |
374216 KB |
Output is correct |
17 |
Correct |
201 ms |
374200 KB |
Output is correct |
18 |
Correct |
199 ms |
374228 KB |
Output is correct |
19 |
Correct |
205 ms |
374432 KB |
Output is correct |
20 |
Correct |
201 ms |
374340 KB |
Output is correct |
21 |
Correct |
204 ms |
374236 KB |
Output is correct |
22 |
Correct |
233 ms |
374200 KB |
Output is correct |
23 |
Correct |
236 ms |
374376 KB |
Output is correct |
24 |
Correct |
226 ms |
374228 KB |
Output is correct |
25 |
Correct |
206 ms |
374252 KB |
Output is correct |
26 |
Correct |
218 ms |
374160 KB |
Output is correct |
27 |
Correct |
221 ms |
374152 KB |
Output is correct |
28 |
Correct |
210 ms |
374244 KB |
Output is correct |
29 |
Correct |
206 ms |
374280 KB |
Output is correct |
30 |
Correct |
205 ms |
374396 KB |
Output is correct |
31 |
Correct |
203 ms |
374272 KB |
Output is correct |
32 |
Correct |
209 ms |
374220 KB |
Output is correct |
33 |
Correct |
206 ms |
374300 KB |
Output is correct |
34 |
Correct |
204 ms |
374196 KB |
Output is correct |
35 |
Correct |
202 ms |
374356 KB |
Output is correct |
36 |
Correct |
205 ms |
374376 KB |
Output is correct |
37 |
Correct |
199 ms |
374276 KB |
Output is correct |
38 |
Correct |
204 ms |
374296 KB |
Output is correct |
39 |
Correct |
203 ms |
374176 KB |
Output is correct |
40 |
Correct |
204 ms |
374304 KB |
Output is correct |
41 |
Correct |
202 ms |
374232 KB |
Output is correct |
42 |
Correct |
203 ms |
374220 KB |
Output is correct |
43 |
Correct |
205 ms |
374176 KB |
Output is correct |
44 |
Correct |
202 ms |
374352 KB |
Output is correct |
45 |
Correct |
203 ms |
374288 KB |
Output is correct |
46 |
Correct |
205 ms |
374220 KB |
Output is correct |
47 |
Correct |
200 ms |
374240 KB |
Output is correct |
48 |
Correct |
202 ms |
374216 KB |
Output is correct |
49 |
Correct |
202 ms |
374228 KB |
Output is correct |
50 |
Correct |
199 ms |
374236 KB |
Output is correct |
51 |
Correct |
205 ms |
374224 KB |
Output is correct |
52 |
Correct |
200 ms |
374280 KB |
Output is correct |
53 |
Correct |
199 ms |
374312 KB |
Output is correct |
54 |
Correct |
201 ms |
374220 KB |
Output is correct |
55 |
Correct |
217 ms |
374288 KB |
Output is correct |
56 |
Correct |
210 ms |
374340 KB |
Output is correct |
57 |
Correct |
208 ms |
374212 KB |
Output is correct |
58 |
Correct |
204 ms |
374224 KB |
Output is correct |
59 |
Correct |
205 ms |
374284 KB |
Output is correct |
60 |
Correct |
201 ms |
374452 KB |
Output is correct |
61 |
Correct |
202 ms |
374228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
374200 KB |
Output is correct |
2 |
Correct |
236 ms |
374376 KB |
Output is correct |
3 |
Correct |
196 ms |
374264 KB |
Output is correct |
4 |
Correct |
200 ms |
374224 KB |
Output is correct |
5 |
Correct |
201 ms |
374236 KB |
Output is correct |
6 |
Correct |
203 ms |
374244 KB |
Output is correct |
7 |
Correct |
204 ms |
374304 KB |
Output is correct |
8 |
Correct |
202 ms |
374284 KB |
Output is correct |
9 |
Correct |
200 ms |
374196 KB |
Output is correct |
10 |
Correct |
201 ms |
374184 KB |
Output is correct |
11 |
Correct |
201 ms |
374220 KB |
Output is correct |
12 |
Correct |
203 ms |
374272 KB |
Output is correct |
13 |
Correct |
200 ms |
374288 KB |
Output is correct |
14 |
Correct |
202 ms |
374292 KB |
Output is correct |
15 |
Correct |
207 ms |
374252 KB |
Output is correct |
16 |
Correct |
204 ms |
374308 KB |
Output is correct |
17 |
Correct |
203 ms |
374232 KB |
Output is correct |
18 |
Correct |
203 ms |
374216 KB |
Output is correct |
19 |
Correct |
201 ms |
374200 KB |
Output is correct |
20 |
Correct |
199 ms |
374228 KB |
Output is correct |
21 |
Correct |
205 ms |
374432 KB |
Output is correct |
22 |
Correct |
201 ms |
374340 KB |
Output is correct |
23 |
Correct |
204 ms |
374236 KB |
Output is correct |
24 |
Correct |
218 ms |
378144 KB |
Output is correct |
25 |
Correct |
217 ms |
378204 KB |
Output is correct |
26 |
Correct |
215 ms |
378176 KB |
Output is correct |
27 |
Correct |
226 ms |
374228 KB |
Output is correct |
28 |
Correct |
206 ms |
374252 KB |
Output is correct |
29 |
Correct |
218 ms |
374160 KB |
Output is correct |
30 |
Correct |
221 ms |
374152 KB |
Output is correct |
31 |
Correct |
210 ms |
374244 KB |
Output is correct |
32 |
Correct |
206 ms |
374280 KB |
Output is correct |
33 |
Correct |
205 ms |
374396 KB |
Output is correct |
34 |
Correct |
203 ms |
374272 KB |
Output is correct |
35 |
Correct |
209 ms |
374220 KB |
Output is correct |
36 |
Correct |
206 ms |
374300 KB |
Output is correct |
37 |
Correct |
204 ms |
374196 KB |
Output is correct |
38 |
Correct |
202 ms |
374356 KB |
Output is correct |
39 |
Correct |
205 ms |
374376 KB |
Output is correct |
40 |
Correct |
199 ms |
374276 KB |
Output is correct |
41 |
Correct |
204 ms |
374296 KB |
Output is correct |
42 |
Correct |
203 ms |
374176 KB |
Output is correct |
43 |
Correct |
204 ms |
374304 KB |
Output is correct |
44 |
Correct |
202 ms |
374232 KB |
Output is correct |
45 |
Correct |
203 ms |
374220 KB |
Output is correct |
46 |
Correct |
205 ms |
374176 KB |
Output is correct |
47 |
Correct |
202 ms |
374352 KB |
Output is correct |
48 |
Correct |
203 ms |
374288 KB |
Output is correct |
49 |
Correct |
205 ms |
374220 KB |
Output is correct |
50 |
Correct |
200 ms |
374240 KB |
Output is correct |
51 |
Correct |
202 ms |
374216 KB |
Output is correct |
52 |
Correct |
202 ms |
374228 KB |
Output is correct |
53 |
Correct |
199 ms |
374236 KB |
Output is correct |
54 |
Correct |
205 ms |
374224 KB |
Output is correct |
55 |
Correct |
200 ms |
374280 KB |
Output is correct |
56 |
Correct |
199 ms |
374312 KB |
Output is correct |
57 |
Correct |
201 ms |
374220 KB |
Output is correct |
58 |
Correct |
217 ms |
374288 KB |
Output is correct |
59 |
Correct |
210 ms |
374340 KB |
Output is correct |
60 |
Correct |
208 ms |
374212 KB |
Output is correct |
61 |
Correct |
204 ms |
374224 KB |
Output is correct |
62 |
Correct |
205 ms |
374284 KB |
Output is correct |
63 |
Correct |
201 ms |
374452 KB |
Output is correct |
64 |
Correct |
202 ms |
374228 KB |
Output is correct |
65 |
Correct |
206 ms |
374224 KB |
Output is correct |
66 |
Correct |
207 ms |
374188 KB |
Output is correct |
67 |
Correct |
203 ms |
374288 KB |
Output is correct |
68 |
Correct |
202 ms |
374212 KB |
Output is correct |
69 |
Correct |
205 ms |
374184 KB |
Output is correct |
70 |
Correct |
206 ms |
374424 KB |
Output is correct |
71 |
Correct |
205 ms |
374396 KB |
Output is correct |
72 |
Correct |
202 ms |
374424 KB |
Output is correct |
73 |
Correct |
201 ms |
374324 KB |
Output is correct |
74 |
Correct |
213 ms |
374420 KB |
Output is correct |
75 |
Correct |
200 ms |
374396 KB |
Output is correct |
76 |
Correct |
214 ms |
376888 KB |
Output is correct |
77 |
Correct |
215 ms |
377288 KB |
Output is correct |
78 |
Correct |
220 ms |
377732 KB |
Output is correct |
79 |
Correct |
210 ms |
374200 KB |
Output is correct |
80 |
Correct |
208 ms |
374272 KB |
Output is correct |
81 |
Correct |
206 ms |
374344 KB |
Output is correct |
82 |
Correct |
208 ms |
374280 KB |
Output is correct |
83 |
Correct |
202 ms |
374240 KB |
Output is correct |
84 |
Correct |
204 ms |
374528 KB |
Output is correct |
85 |
Correct |
211 ms |
374600 KB |
Output is correct |
86 |
Correct |
225 ms |
374536 KB |
Output is correct |
87 |
Correct |
205 ms |
374416 KB |
Output is correct |
88 |
Correct |
202 ms |
374468 KB |
Output is correct |
89 |
Correct |
202 ms |
374412 KB |
Output is correct |
90 |
Correct |
219 ms |
378016 KB |
Output is correct |
91 |
Correct |
221 ms |
378004 KB |
Output is correct |
92 |
Correct |
225 ms |
378096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
374200 KB |
Output is correct |
2 |
Correct |
236 ms |
374376 KB |
Output is correct |
3 |
Correct |
196 ms |
374264 KB |
Output is correct |
4 |
Correct |
200 ms |
374224 KB |
Output is correct |
5 |
Correct |
201 ms |
374236 KB |
Output is correct |
6 |
Correct |
203 ms |
374244 KB |
Output is correct |
7 |
Correct |
204 ms |
374304 KB |
Output is correct |
8 |
Correct |
202 ms |
374284 KB |
Output is correct |
9 |
Correct |
200 ms |
374196 KB |
Output is correct |
10 |
Correct |
201 ms |
374184 KB |
Output is correct |
11 |
Correct |
201 ms |
374220 KB |
Output is correct |
12 |
Correct |
203 ms |
374272 KB |
Output is correct |
13 |
Correct |
200 ms |
374288 KB |
Output is correct |
14 |
Correct |
202 ms |
374292 KB |
Output is correct |
15 |
Correct |
207 ms |
374252 KB |
Output is correct |
16 |
Correct |
204 ms |
374308 KB |
Output is correct |
17 |
Correct |
203 ms |
374232 KB |
Output is correct |
18 |
Correct |
203 ms |
374216 KB |
Output is correct |
19 |
Correct |
201 ms |
374200 KB |
Output is correct |
20 |
Correct |
199 ms |
374228 KB |
Output is correct |
21 |
Correct |
205 ms |
374432 KB |
Output is correct |
22 |
Correct |
201 ms |
374340 KB |
Output is correct |
23 |
Correct |
204 ms |
374236 KB |
Output is correct |
24 |
Correct |
218 ms |
378144 KB |
Output is correct |
25 |
Correct |
217 ms |
378204 KB |
Output is correct |
26 |
Correct |
215 ms |
378176 KB |
Output is correct |
27 |
Correct |
206 ms |
374864 KB |
Output is correct |
28 |
Correct |
211 ms |
374588 KB |
Output is correct |
29 |
Correct |
208 ms |
374656 KB |
Output is correct |
30 |
Correct |
210 ms |
374656 KB |
Output is correct |
31 |
Correct |
208 ms |
374608 KB |
Output is correct |
32 |
Correct |
216 ms |
374592 KB |
Output is correct |
33 |
Correct |
217 ms |
375500 KB |
Output is correct |
34 |
Correct |
227 ms |
375472 KB |
Output is correct |
35 |
Correct |
217 ms |
375460 KB |
Output is correct |
36 |
Correct |
214 ms |
375564 KB |
Output is correct |
37 |
Correct |
215 ms |
375556 KB |
Output is correct |
38 |
Correct |
214 ms |
375580 KB |
Output is correct |
39 |
Correct |
221 ms |
378736 KB |
Output is correct |
40 |
Correct |
225 ms |
378616 KB |
Output is correct |
41 |
Correct |
226 ms |
378704 KB |
Output is correct |
42 |
Correct |
226 ms |
374228 KB |
Output is correct |
43 |
Correct |
206 ms |
374252 KB |
Output is correct |
44 |
Correct |
218 ms |
374160 KB |
Output is correct |
45 |
Correct |
221 ms |
374152 KB |
Output is correct |
46 |
Correct |
210 ms |
374244 KB |
Output is correct |
47 |
Correct |
206 ms |
374280 KB |
Output is correct |
48 |
Correct |
205 ms |
374396 KB |
Output is correct |
49 |
Correct |
203 ms |
374272 KB |
Output is correct |
50 |
Correct |
209 ms |
374220 KB |
Output is correct |
51 |
Correct |
206 ms |
374300 KB |
Output is correct |
52 |
Correct |
204 ms |
374196 KB |
Output is correct |
53 |
Correct |
202 ms |
374356 KB |
Output is correct |
54 |
Correct |
205 ms |
374376 KB |
Output is correct |
55 |
Correct |
199 ms |
374276 KB |
Output is correct |
56 |
Correct |
204 ms |
374296 KB |
Output is correct |
57 |
Correct |
203 ms |
374176 KB |
Output is correct |
58 |
Correct |
204 ms |
374304 KB |
Output is correct |
59 |
Correct |
202 ms |
374232 KB |
Output is correct |
60 |
Correct |
203 ms |
374220 KB |
Output is correct |
61 |
Correct |
205 ms |
374176 KB |
Output is correct |
62 |
Correct |
202 ms |
374352 KB |
Output is correct |
63 |
Correct |
203 ms |
374288 KB |
Output is correct |
64 |
Correct |
205 ms |
374220 KB |
Output is correct |
65 |
Correct |
200 ms |
374240 KB |
Output is correct |
66 |
Correct |
202 ms |
374216 KB |
Output is correct |
67 |
Correct |
202 ms |
374228 KB |
Output is correct |
68 |
Correct |
199 ms |
374236 KB |
Output is correct |
69 |
Correct |
205 ms |
374224 KB |
Output is correct |
70 |
Correct |
200 ms |
374280 KB |
Output is correct |
71 |
Correct |
199 ms |
374312 KB |
Output is correct |
72 |
Correct |
201 ms |
374220 KB |
Output is correct |
73 |
Correct |
217 ms |
374288 KB |
Output is correct |
74 |
Correct |
210 ms |
374340 KB |
Output is correct |
75 |
Correct |
208 ms |
374212 KB |
Output is correct |
76 |
Correct |
204 ms |
374224 KB |
Output is correct |
77 |
Correct |
205 ms |
374284 KB |
Output is correct |
78 |
Correct |
201 ms |
374452 KB |
Output is correct |
79 |
Correct |
202 ms |
374228 KB |
Output is correct |
80 |
Correct |
206 ms |
374224 KB |
Output is correct |
81 |
Correct |
207 ms |
374188 KB |
Output is correct |
82 |
Correct |
203 ms |
374288 KB |
Output is correct |
83 |
Correct |
202 ms |
374212 KB |
Output is correct |
84 |
Correct |
205 ms |
374184 KB |
Output is correct |
85 |
Correct |
206 ms |
374424 KB |
Output is correct |
86 |
Correct |
205 ms |
374396 KB |
Output is correct |
87 |
Correct |
202 ms |
374424 KB |
Output is correct |
88 |
Correct |
201 ms |
374324 KB |
Output is correct |
89 |
Correct |
213 ms |
374420 KB |
Output is correct |
90 |
Correct |
200 ms |
374396 KB |
Output is correct |
91 |
Correct |
214 ms |
376888 KB |
Output is correct |
92 |
Correct |
215 ms |
377288 KB |
Output is correct |
93 |
Correct |
220 ms |
377732 KB |
Output is correct |
94 |
Correct |
210 ms |
374200 KB |
Output is correct |
95 |
Correct |
208 ms |
374272 KB |
Output is correct |
96 |
Correct |
206 ms |
374344 KB |
Output is correct |
97 |
Correct |
208 ms |
374280 KB |
Output is correct |
98 |
Correct |
202 ms |
374240 KB |
Output is correct |
99 |
Correct |
204 ms |
374528 KB |
Output is correct |
100 |
Correct |
211 ms |
374600 KB |
Output is correct |
101 |
Correct |
225 ms |
374536 KB |
Output is correct |
102 |
Correct |
205 ms |
374416 KB |
Output is correct |
103 |
Correct |
202 ms |
374468 KB |
Output is correct |
104 |
Correct |
202 ms |
374412 KB |
Output is correct |
105 |
Correct |
219 ms |
378016 KB |
Output is correct |
106 |
Correct |
221 ms |
378004 KB |
Output is correct |
107 |
Correct |
225 ms |
378096 KB |
Output is correct |
108 |
Correct |
221 ms |
374576 KB |
Output is correct |
109 |
Correct |
655 ms |
374712 KB |
Output is correct |
110 |
Correct |
713 ms |
374748 KB |
Output is correct |
111 |
Correct |
554 ms |
374476 KB |
Output is correct |
112 |
Correct |
579 ms |
374732 KB |
Output is correct |
113 |
Correct |
423 ms |
374596 KB |
Output is correct |
114 |
Correct |
215 ms |
375628 KB |
Output is correct |
115 |
Correct |
213 ms |
375480 KB |
Output is correct |
116 |
Correct |
223 ms |
375756 KB |
Output is correct |
117 |
Correct |
213 ms |
375636 KB |
Output is correct |
118 |
Correct |
219 ms |
375704 KB |
Output is correct |
119 |
Correct |
220 ms |
375436 KB |
Output is correct |
120 |
Correct |
218 ms |
376832 KB |
Output is correct |
121 |
Correct |
210 ms |
374872 KB |
Output is correct |
122 |
Correct |
222 ms |
376988 KB |
Output is correct |
123 |
Correct |
207 ms |
374924 KB |
Output is correct |
124 |
Correct |
223 ms |
377508 KB |
Output is correct |
125 |
Correct |
213 ms |
375076 KB |
Output is correct |
126 |
Correct |
210 ms |
375152 KB |
Output is correct |
127 |
Correct |
230 ms |
375472 KB |
Output is correct |
128 |
Correct |
219 ms |
375028 KB |
Output is correct |
129 |
Correct |
209 ms |
375052 KB |
Output is correct |
130 |
Correct |
207 ms |
374596 KB |
Output is correct |
131 |
Correct |
840 ms |
374816 KB |
Output is correct |
132 |
Correct |
1156 ms |
374652 KB |
Output is correct |
133 |
Correct |
908 ms |
374852 KB |
Output is correct |
134 |
Correct |
768 ms |
374760 KB |
Output is correct |
135 |
Correct |
691 ms |
374880 KB |
Output is correct |
136 |
Correct |
228 ms |
376012 KB |
Output is correct |
137 |
Correct |
224 ms |
376004 KB |
Output is correct |
138 |
Correct |
227 ms |
376040 KB |
Output is correct |
139 |
Correct |
253 ms |
376056 KB |
Output is correct |
140 |
Correct |
225 ms |
376012 KB |
Output is correct |
141 |
Correct |
228 ms |
375964 KB |
Output is correct |
142 |
Correct |
234 ms |
378500 KB |
Output is correct |
143 |
Correct |
220 ms |
375256 KB |
Output is correct |
144 |
Correct |
230 ms |
378460 KB |
Output is correct |
145 |
Correct |
216 ms |
375244 KB |
Output is correct |
146 |
Correct |
229 ms |
378612 KB |
Output is correct |
147 |
Correct |
213 ms |
375316 KB |
Output is correct |
148 |
Correct |
217 ms |
375692 KB |
Output is correct |
149 |
Correct |
215 ms |
375556 KB |
Output is correct |
150 |
Correct |
214 ms |
375556 KB |
Output is correct |
151 |
Correct |
213 ms |
375540 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
233 ms |
374200 KB |
Output is correct |
2 |
Correct |
236 ms |
374376 KB |
Output is correct |
3 |
Correct |
196 ms |
374264 KB |
Output is correct |
4 |
Correct |
200 ms |
374224 KB |
Output is correct |
5 |
Correct |
201 ms |
374236 KB |
Output is correct |
6 |
Correct |
203 ms |
374244 KB |
Output is correct |
7 |
Correct |
204 ms |
374304 KB |
Output is correct |
8 |
Correct |
202 ms |
374284 KB |
Output is correct |
9 |
Correct |
200 ms |
374196 KB |
Output is correct |
10 |
Correct |
201 ms |
374184 KB |
Output is correct |
11 |
Correct |
201 ms |
374220 KB |
Output is correct |
12 |
Correct |
203 ms |
374272 KB |
Output is correct |
13 |
Correct |
200 ms |
374288 KB |
Output is correct |
14 |
Correct |
202 ms |
374292 KB |
Output is correct |
15 |
Correct |
207 ms |
374252 KB |
Output is correct |
16 |
Correct |
204 ms |
374308 KB |
Output is correct |
17 |
Correct |
203 ms |
374232 KB |
Output is correct |
18 |
Correct |
203 ms |
374216 KB |
Output is correct |
19 |
Correct |
201 ms |
374200 KB |
Output is correct |
20 |
Correct |
199 ms |
374228 KB |
Output is correct |
21 |
Correct |
205 ms |
374432 KB |
Output is correct |
22 |
Correct |
201 ms |
374340 KB |
Output is correct |
23 |
Correct |
204 ms |
374236 KB |
Output is correct |
24 |
Correct |
218 ms |
378144 KB |
Output is correct |
25 |
Correct |
217 ms |
378204 KB |
Output is correct |
26 |
Correct |
215 ms |
378176 KB |
Output is correct |
27 |
Correct |
206 ms |
374864 KB |
Output is correct |
28 |
Correct |
211 ms |
374588 KB |
Output is correct |
29 |
Correct |
208 ms |
374656 KB |
Output is correct |
30 |
Correct |
210 ms |
374656 KB |
Output is correct |
31 |
Correct |
208 ms |
374608 KB |
Output is correct |
32 |
Correct |
216 ms |
374592 KB |
Output is correct |
33 |
Correct |
217 ms |
375500 KB |
Output is correct |
34 |
Correct |
227 ms |
375472 KB |
Output is correct |
35 |
Correct |
217 ms |
375460 KB |
Output is correct |
36 |
Correct |
214 ms |
375564 KB |
Output is correct |
37 |
Correct |
215 ms |
375556 KB |
Output is correct |
38 |
Correct |
214 ms |
375580 KB |
Output is correct |
39 |
Correct |
221 ms |
378736 KB |
Output is correct |
40 |
Correct |
225 ms |
378616 KB |
Output is correct |
41 |
Correct |
226 ms |
378704 KB |
Output is correct |
42 |
Correct |
238 ms |
375676 KB |
Output is correct |
43 |
Correct |
224 ms |
375104 KB |
Output is correct |
44 |
Correct |
224 ms |
375612 KB |
Output is correct |
45 |
Correct |
217 ms |
375128 KB |
Output is correct |
46 |
Correct |
213 ms |
375144 KB |
Output is correct |
47 |
Correct |
218 ms |
375624 KB |
Output is correct |
48 |
Correct |
262 ms |
384588 KB |
Output is correct |
49 |
Correct |
249 ms |
379848 KB |
Output is correct |
50 |
Correct |
243 ms |
382228 KB |
Output is correct |
51 |
Correct |
236 ms |
382372 KB |
Output is correct |
52 |
Correct |
232 ms |
382288 KB |
Output is correct |
53 |
Correct |
227 ms |
379984 KB |
Output is correct |
54 |
Correct |
245 ms |
375804 KB |
Output is correct |
55 |
Correct |
241 ms |
375684 KB |
Output is correct |
56 |
Correct |
231 ms |
375620 KB |
Output is correct |
57 |
Correct |
225 ms |
375704 KB |
Output is correct |
58 |
Correct |
222 ms |
375696 KB |
Output is correct |
59 |
Correct |
226 ms |
375652 KB |
Output is correct |
60 |
Correct |
288 ms |
385288 KB |
Output is correct |
61 |
Correct |
302 ms |
385280 KB |
Output is correct |
62 |
Correct |
287 ms |
385284 KB |
Output is correct |
63 |
Correct |
305 ms |
385224 KB |
Output is correct |
64 |
Correct |
293 ms |
385244 KB |
Output is correct |
65 |
Correct |
288 ms |
385220 KB |
Output is correct |
66 |
Correct |
268 ms |
383956 KB |
Output is correct |
67 |
Correct |
269 ms |
383904 KB |
Output is correct |
68 |
Correct |
281 ms |
383828 KB |
Output is correct |
69 |
Correct |
226 ms |
374228 KB |
Output is correct |
70 |
Correct |
206 ms |
374252 KB |
Output is correct |
71 |
Correct |
218 ms |
374160 KB |
Output is correct |
72 |
Correct |
221 ms |
374152 KB |
Output is correct |
73 |
Correct |
210 ms |
374244 KB |
Output is correct |
74 |
Correct |
206 ms |
374280 KB |
Output is correct |
75 |
Correct |
205 ms |
374396 KB |
Output is correct |
76 |
Correct |
203 ms |
374272 KB |
Output is correct |
77 |
Correct |
209 ms |
374220 KB |
Output is correct |
78 |
Correct |
206 ms |
374300 KB |
Output is correct |
79 |
Correct |
204 ms |
374196 KB |
Output is correct |
80 |
Correct |
202 ms |
374356 KB |
Output is correct |
81 |
Correct |
205 ms |
374376 KB |
Output is correct |
82 |
Correct |
199 ms |
374276 KB |
Output is correct |
83 |
Correct |
204 ms |
374296 KB |
Output is correct |
84 |
Correct |
203 ms |
374176 KB |
Output is correct |
85 |
Correct |
204 ms |
374304 KB |
Output is correct |
86 |
Correct |
202 ms |
374232 KB |
Output is correct |
87 |
Correct |
203 ms |
374220 KB |
Output is correct |
88 |
Correct |
205 ms |
374176 KB |
Output is correct |
89 |
Correct |
202 ms |
374352 KB |
Output is correct |
90 |
Correct |
203 ms |
374288 KB |
Output is correct |
91 |
Correct |
205 ms |
374220 KB |
Output is correct |
92 |
Correct |
200 ms |
374240 KB |
Output is correct |
93 |
Correct |
202 ms |
374216 KB |
Output is correct |
94 |
Correct |
202 ms |
374228 KB |
Output is correct |
95 |
Correct |
199 ms |
374236 KB |
Output is correct |
96 |
Correct |
205 ms |
374224 KB |
Output is correct |
97 |
Correct |
200 ms |
374280 KB |
Output is correct |
98 |
Correct |
199 ms |
374312 KB |
Output is correct |
99 |
Correct |
201 ms |
374220 KB |
Output is correct |
100 |
Correct |
217 ms |
374288 KB |
Output is correct |
101 |
Correct |
210 ms |
374340 KB |
Output is correct |
102 |
Correct |
208 ms |
374212 KB |
Output is correct |
103 |
Correct |
204 ms |
374224 KB |
Output is correct |
104 |
Correct |
205 ms |
374284 KB |
Output is correct |
105 |
Correct |
201 ms |
374452 KB |
Output is correct |
106 |
Correct |
202 ms |
374228 KB |
Output is correct |
107 |
Correct |
206 ms |
374224 KB |
Output is correct |
108 |
Correct |
207 ms |
374188 KB |
Output is correct |
109 |
Correct |
203 ms |
374288 KB |
Output is correct |
110 |
Correct |
202 ms |
374212 KB |
Output is correct |
111 |
Correct |
205 ms |
374184 KB |
Output is correct |
112 |
Correct |
206 ms |
374424 KB |
Output is correct |
113 |
Correct |
205 ms |
374396 KB |
Output is correct |
114 |
Correct |
202 ms |
374424 KB |
Output is correct |
115 |
Correct |
201 ms |
374324 KB |
Output is correct |
116 |
Correct |
213 ms |
374420 KB |
Output is correct |
117 |
Correct |
200 ms |
374396 KB |
Output is correct |
118 |
Correct |
214 ms |
376888 KB |
Output is correct |
119 |
Correct |
215 ms |
377288 KB |
Output is correct |
120 |
Correct |
220 ms |
377732 KB |
Output is correct |
121 |
Correct |
210 ms |
374200 KB |
Output is correct |
122 |
Correct |
208 ms |
374272 KB |
Output is correct |
123 |
Correct |
206 ms |
374344 KB |
Output is correct |
124 |
Correct |
208 ms |
374280 KB |
Output is correct |
125 |
Correct |
202 ms |
374240 KB |
Output is correct |
126 |
Correct |
204 ms |
374528 KB |
Output is correct |
127 |
Correct |
211 ms |
374600 KB |
Output is correct |
128 |
Correct |
225 ms |
374536 KB |
Output is correct |
129 |
Correct |
205 ms |
374416 KB |
Output is correct |
130 |
Correct |
202 ms |
374468 KB |
Output is correct |
131 |
Correct |
202 ms |
374412 KB |
Output is correct |
132 |
Correct |
219 ms |
378016 KB |
Output is correct |
133 |
Correct |
221 ms |
378004 KB |
Output is correct |
134 |
Correct |
225 ms |
378096 KB |
Output is correct |
135 |
Correct |
221 ms |
374576 KB |
Output is correct |
136 |
Correct |
655 ms |
374712 KB |
Output is correct |
137 |
Correct |
713 ms |
374748 KB |
Output is correct |
138 |
Correct |
554 ms |
374476 KB |
Output is correct |
139 |
Correct |
579 ms |
374732 KB |
Output is correct |
140 |
Correct |
423 ms |
374596 KB |
Output is correct |
141 |
Correct |
215 ms |
375628 KB |
Output is correct |
142 |
Correct |
213 ms |
375480 KB |
Output is correct |
143 |
Correct |
223 ms |
375756 KB |
Output is correct |
144 |
Correct |
213 ms |
375636 KB |
Output is correct |
145 |
Correct |
219 ms |
375704 KB |
Output is correct |
146 |
Correct |
220 ms |
375436 KB |
Output is correct |
147 |
Correct |
218 ms |
376832 KB |
Output is correct |
148 |
Correct |
210 ms |
374872 KB |
Output is correct |
149 |
Correct |
222 ms |
376988 KB |
Output is correct |
150 |
Correct |
207 ms |
374924 KB |
Output is correct |
151 |
Correct |
223 ms |
377508 KB |
Output is correct |
152 |
Correct |
213 ms |
375076 KB |
Output is correct |
153 |
Correct |
210 ms |
375152 KB |
Output is correct |
154 |
Correct |
230 ms |
375472 KB |
Output is correct |
155 |
Correct |
219 ms |
375028 KB |
Output is correct |
156 |
Correct |
209 ms |
375052 KB |
Output is correct |
157 |
Correct |
207 ms |
374596 KB |
Output is correct |
158 |
Correct |
840 ms |
374816 KB |
Output is correct |
159 |
Correct |
1156 ms |
374652 KB |
Output is correct |
160 |
Correct |
908 ms |
374852 KB |
Output is correct |
161 |
Correct |
768 ms |
374760 KB |
Output is correct |
162 |
Correct |
691 ms |
374880 KB |
Output is correct |
163 |
Correct |
228 ms |
376012 KB |
Output is correct |
164 |
Correct |
224 ms |
376004 KB |
Output is correct |
165 |
Correct |
227 ms |
376040 KB |
Output is correct |
166 |
Correct |
253 ms |
376056 KB |
Output is correct |
167 |
Correct |
225 ms |
376012 KB |
Output is correct |
168 |
Correct |
228 ms |
375964 KB |
Output is correct |
169 |
Correct |
234 ms |
378500 KB |
Output is correct |
170 |
Correct |
220 ms |
375256 KB |
Output is correct |
171 |
Correct |
230 ms |
378460 KB |
Output is correct |
172 |
Correct |
216 ms |
375244 KB |
Output is correct |
173 |
Correct |
229 ms |
378612 KB |
Output is correct |
174 |
Correct |
213 ms |
375316 KB |
Output is correct |
175 |
Correct |
217 ms |
375692 KB |
Output is correct |
176 |
Correct |
215 ms |
375556 KB |
Output is correct |
177 |
Correct |
214 ms |
375556 KB |
Output is correct |
178 |
Correct |
213 ms |
375540 KB |
Output is correct |
179 |
Correct |
232 ms |
375136 KB |
Output is correct |
180 |
Correct |
1444 ms |
375252 KB |
Output is correct |
181 |
Execution timed out |
1596 ms |
375720 KB |
Time limit exceeded |
182 |
Halted |
0 ms |
0 KB |
- |