Submission #547497

# Submission time Handle Problem Language Result Execution time Memory
547497 2022-04-10T21:18:20 Z Deepesson Painting Walls (APIO20_paint) C++17
63 / 100
1500 ms 513096 KB
#include "paint.h"
#include <bits/stdc++.h>
#define MAX 100004
typedef std::pair<int,int> pii;
pii pai[MAX][633];
int mod(int p,int M){
    p%=M;
    if(p<0)p+=M;
    return p;
}

pii find(pii x){
    auto&ref = pai[x.first][x.second];
    if(ref==x)
        return x;
    return ref=find(ref);
}

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);
        pai[a.first][a.second]=b;
       /// 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!=700;++j){
            pai[i][j]={i,j};
        }
    }
    for(int i=0;i!=M;++i){
        for(auto& x:B[i]){
            curte[x].push_back(i);
        }
    }
    for(int i=0;i!=N-1;++i){
        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:59:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         for(int j=0;j!=curte[cor1].size();++j){
      |                     ~^~~~~~~~~~~~~~~~~~~~
paint.cpp:61:17: warning: unused variable 'tipo' [-Wunused-variable]
   61 |             int tipo = x,prox = mod(x+1,M);
      |                 ^~~~
paint.cpp:91:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |         for(int j=0;j!=curte[C[i]].size();++j){
      |                     ~^~~~~~~~~~~~~~~~~~~~
paint.cpp:111:9: warning: unused variable 'min' [-Wunused-variable]
  111 |     int min = 1e9;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 221 ms 498236 KB Output is correct
2 Correct 222 ms 498132 KB Output is correct
3 Correct 228 ms 498124 KB Output is correct
4 Correct 224 ms 498044 KB Output is correct
5 Correct 283 ms 498132 KB Output is correct
6 Correct 232 ms 498152 KB Output is correct
7 Correct 279 ms 498124 KB Output is correct
8 Correct 228 ms 498140 KB Output is correct
9 Correct 254 ms 498088 KB Output is correct
10 Correct 255 ms 498084 KB Output is correct
11 Correct 244 ms 498088 KB Output is correct
12 Correct 262 ms 498120 KB Output is correct
13 Correct 253 ms 498132 KB Output is correct
14 Correct 247 ms 498136 KB Output is correct
15 Correct 245 ms 498104 KB Output is correct
16 Correct 247 ms 498156 KB Output is correct
17 Correct 263 ms 498180 KB Output is correct
18 Correct 256 ms 498196 KB Output is correct
19 Correct 264 ms 498132 KB Output is correct
20 Correct 278 ms 498112 KB Output is correct
21 Correct 240 ms 498168 KB Output is correct
22 Correct 250 ms 502612 KB Output is correct
23 Correct 250 ms 502628 KB Output is correct
24 Correct 269 ms 502592 KB Output is correct
25 Correct 277 ms 498904 KB Output is correct
26 Correct 257 ms 498984 KB Output is correct
27 Correct 251 ms 498276 KB Output is correct
28 Correct 244 ms 498252 KB Output is correct
29 Correct 268 ms 498348 KB Output is correct
30 Correct 248 ms 498312 KB Output is correct
31 Correct 276 ms 500128 KB Output is correct
32 Correct 264 ms 500024 KB Output is correct
33 Correct 244 ms 500088 KB Output is correct
34 Correct 275 ms 500040 KB Output is correct
35 Correct 289 ms 500116 KB Output is correct
36 Correct 252 ms 500088 KB Output is correct
37 Correct 254 ms 502964 KB Output is correct
38 Correct 279 ms 503080 KB Output is correct
39 Correct 273 ms 503148 KB Output is correct
40 Correct 264 ms 501916 KB Output is correct
41 Correct 247 ms 500536 KB Output is correct
42 Correct 264 ms 499140 KB Output is correct
43 Correct 251 ms 498860 KB Output is correct
44 Correct 241 ms 498728 KB Output is correct
45 Correct 239 ms 499196 KB Output is correct
46 Correct 295 ms 511624 KB Output is correct
47 Correct 276 ms 506016 KB Output is correct
48 Correct 273 ms 508292 KB Output is correct
49 Correct 276 ms 506764 KB Output is correct
50 Correct 264 ms 506316 KB Output is correct
51 Correct 282 ms 504192 KB Output is correct
52 Correct 258 ms 502308 KB Output is correct
53 Correct 259 ms 502348 KB Output is correct
54 Correct 265 ms 499348 KB Output is correct
55 Correct 291 ms 499172 KB Output is correct
56 Correct 271 ms 499128 KB Output is correct
57 Correct 297 ms 499148 KB Output is correct
58 Correct 303 ms 513096 KB Output is correct
59 Correct 314 ms 512988 KB Output is correct
60 Correct 293 ms 513004 KB Output is correct
61 Correct 299 ms 513012 KB Output is correct
62 Correct 309 ms 512968 KB Output is correct
63 Correct 315 ms 512944 KB Output is correct
64 Correct 282 ms 508332 KB Output is correct
65 Correct 279 ms 508400 KB Output is correct
66 Correct 279 ms 508360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 498236 KB Output is correct
2 Correct 222 ms 498132 KB Output is correct
3 Correct 228 ms 498124 KB Output is correct
4 Correct 224 ms 498044 KB Output is correct
5 Correct 283 ms 498132 KB Output is correct
6 Correct 232 ms 498152 KB Output is correct
7 Correct 279 ms 498124 KB Output is correct
8 Correct 228 ms 498140 KB Output is correct
9 Correct 254 ms 498088 KB Output is correct
10 Correct 255 ms 498084 KB Output is correct
11 Correct 244 ms 498088 KB Output is correct
12 Correct 262 ms 498120 KB Output is correct
13 Correct 253 ms 498132 KB Output is correct
14 Correct 247 ms 498136 KB Output is correct
15 Correct 245 ms 498104 KB Output is correct
16 Correct 247 ms 498156 KB Output is correct
17 Correct 263 ms 498180 KB Output is correct
18 Correct 256 ms 498196 KB Output is correct
19 Correct 264 ms 498132 KB Output is correct
20 Correct 278 ms 498112 KB Output is correct
21 Correct 240 ms 498168 KB Output is correct
22 Correct 262 ms 498040 KB Output is correct
23 Correct 263 ms 498084 KB Output is correct
24 Correct 246 ms 498088 KB Output is correct
25 Correct 231 ms 498076 KB Output is correct
26 Correct 265 ms 498092 KB Output is correct
27 Correct 240 ms 498112 KB Output is correct
28 Correct 231 ms 498112 KB Output is correct
29 Correct 228 ms 498148 KB Output is correct
30 Correct 279 ms 498124 KB Output is correct
31 Correct 233 ms 498108 KB Output is correct
32 Correct 236 ms 498092 KB Output is correct
33 Correct 230 ms 498132 KB Output is correct
34 Correct 247 ms 498124 KB Output is correct
35 Correct 232 ms 498108 KB Output is correct
36 Correct 229 ms 498140 KB Output is correct
37 Correct 240 ms 498148 KB Output is correct
38 Correct 237 ms 498124 KB Output is correct
39 Correct 239 ms 498124 KB Output is correct
40 Correct 261 ms 498156 KB Output is correct
41 Correct 232 ms 498068 KB Output is correct
42 Correct 237 ms 498124 KB Output is correct
43 Correct 233 ms 498164 KB Output is correct
44 Correct 231 ms 498124 KB Output is correct
45 Correct 237 ms 498168 KB Output is correct
46 Correct 229 ms 498144 KB Output is correct
47 Correct 230 ms 498108 KB Output is correct
48 Correct 231 ms 498124 KB Output is correct
49 Correct 229 ms 498112 KB Output is correct
50 Correct 228 ms 498124 KB Output is correct
51 Correct 228 ms 498128 KB Output is correct
52 Correct 295 ms 498124 KB Output is correct
53 Correct 265 ms 498156 KB Output is correct
54 Correct 247 ms 498124 KB Output is correct
55 Correct 224 ms 498128 KB Output is correct
56 Correct 222 ms 498156 KB Output is correct
57 Correct 247 ms 498164 KB Output is correct
58 Correct 228 ms 498224 KB Output is correct
59 Correct 214 ms 498260 KB Output is correct
60 Correct 228 ms 498328 KB Output is correct
61 Correct 221 ms 498156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 262 ms 498040 KB Output is correct
2 Correct 263 ms 498084 KB Output is correct
3 Correct 221 ms 498236 KB Output is correct
4 Correct 222 ms 498132 KB Output is correct
5 Correct 228 ms 498124 KB Output is correct
6 Correct 224 ms 498044 KB Output is correct
7 Correct 283 ms 498132 KB Output is correct
8 Correct 232 ms 498152 KB Output is correct
9 Correct 279 ms 498124 KB Output is correct
10 Correct 228 ms 498140 KB Output is correct
11 Correct 254 ms 498088 KB Output is correct
12 Correct 255 ms 498084 KB Output is correct
13 Correct 244 ms 498088 KB Output is correct
14 Correct 262 ms 498120 KB Output is correct
15 Correct 253 ms 498132 KB Output is correct
16 Correct 247 ms 498136 KB Output is correct
17 Correct 245 ms 498104 KB Output is correct
18 Correct 247 ms 498156 KB Output is correct
19 Correct 263 ms 498180 KB Output is correct
20 Correct 256 ms 498196 KB Output is correct
21 Correct 264 ms 498132 KB Output is correct
22 Correct 278 ms 498112 KB Output is correct
23 Correct 240 ms 498168 KB Output is correct
24 Correct 250 ms 502612 KB Output is correct
25 Correct 250 ms 502628 KB Output is correct
26 Correct 269 ms 502592 KB Output is correct
27 Correct 246 ms 498088 KB Output is correct
28 Correct 231 ms 498076 KB Output is correct
29 Correct 265 ms 498092 KB Output is correct
30 Correct 240 ms 498112 KB Output is correct
31 Correct 231 ms 498112 KB Output is correct
32 Correct 228 ms 498148 KB Output is correct
33 Correct 279 ms 498124 KB Output is correct
34 Correct 233 ms 498108 KB Output is correct
35 Correct 236 ms 498092 KB Output is correct
36 Correct 230 ms 498132 KB Output is correct
37 Correct 247 ms 498124 KB Output is correct
38 Correct 232 ms 498108 KB Output is correct
39 Correct 229 ms 498140 KB Output is correct
40 Correct 240 ms 498148 KB Output is correct
41 Correct 237 ms 498124 KB Output is correct
42 Correct 239 ms 498124 KB Output is correct
43 Correct 261 ms 498156 KB Output is correct
44 Correct 232 ms 498068 KB Output is correct
45 Correct 237 ms 498124 KB Output is correct
46 Correct 233 ms 498164 KB Output is correct
47 Correct 231 ms 498124 KB Output is correct
48 Correct 237 ms 498168 KB Output is correct
49 Correct 229 ms 498144 KB Output is correct
50 Correct 230 ms 498108 KB Output is correct
51 Correct 231 ms 498124 KB Output is correct
52 Correct 229 ms 498112 KB Output is correct
53 Correct 228 ms 498124 KB Output is correct
54 Correct 228 ms 498128 KB Output is correct
55 Correct 295 ms 498124 KB Output is correct
56 Correct 265 ms 498156 KB Output is correct
57 Correct 247 ms 498124 KB Output is correct
58 Correct 224 ms 498128 KB Output is correct
59 Correct 222 ms 498156 KB Output is correct
60 Correct 247 ms 498164 KB Output is correct
61 Correct 228 ms 498224 KB Output is correct
62 Correct 214 ms 498260 KB Output is correct
63 Correct 228 ms 498328 KB Output is correct
64 Correct 221 ms 498156 KB Output is correct
65 Correct 230 ms 498080 KB Output is correct
66 Correct 231 ms 498172 KB Output is correct
67 Correct 225 ms 498248 KB Output is correct
68 Correct 221 ms 498072 KB Output is correct
69 Correct 230 ms 498172 KB Output is correct
70 Correct 221 ms 498300 KB Output is correct
71 Correct 222 ms 498392 KB Output is correct
72 Correct 225 ms 498288 KB Output is correct
73 Correct 221 ms 498324 KB Output is correct
74 Correct 220 ms 498504 KB Output is correct
75 Correct 218 ms 498380 KB Output is correct
76 Correct 235 ms 501440 KB Output is correct
77 Correct 235 ms 501912 KB Output is correct
78 Correct 237 ms 502468 KB Output is correct
79 Correct 229 ms 498192 KB Output is correct
80 Correct 222 ms 498164 KB Output is correct
81 Correct 223 ms 498156 KB Output is correct
82 Correct 257 ms 498200 KB Output is correct
83 Correct 227 ms 498124 KB Output is correct
84 Correct 225 ms 498412 KB Output is correct
85 Correct 230 ms 498480 KB Output is correct
86 Correct 223 ms 498432 KB Output is correct
87 Correct 224 ms 498460 KB Output is correct
88 Correct 225 ms 498476 KB Output is correct
89 Correct 225 ms 498380 KB Output is correct
90 Correct 239 ms 502800 KB Output is correct
91 Correct 244 ms 502764 KB Output is correct
92 Correct 241 ms 502744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 262 ms 498040 KB Output is correct
2 Correct 263 ms 498084 KB Output is correct
3 Correct 221 ms 498236 KB Output is correct
4 Correct 222 ms 498132 KB Output is correct
5 Correct 228 ms 498124 KB Output is correct
6 Correct 224 ms 498044 KB Output is correct
7 Correct 283 ms 498132 KB Output is correct
8 Correct 232 ms 498152 KB Output is correct
9 Correct 279 ms 498124 KB Output is correct
10 Correct 228 ms 498140 KB Output is correct
11 Correct 254 ms 498088 KB Output is correct
12 Correct 255 ms 498084 KB Output is correct
13 Correct 244 ms 498088 KB Output is correct
14 Correct 262 ms 498120 KB Output is correct
15 Correct 253 ms 498132 KB Output is correct
16 Correct 247 ms 498136 KB Output is correct
17 Correct 245 ms 498104 KB Output is correct
18 Correct 247 ms 498156 KB Output is correct
19 Correct 263 ms 498180 KB Output is correct
20 Correct 256 ms 498196 KB Output is correct
21 Correct 264 ms 498132 KB Output is correct
22 Correct 278 ms 498112 KB Output is correct
23 Correct 240 ms 498168 KB Output is correct
24 Correct 250 ms 502612 KB Output is correct
25 Correct 250 ms 502628 KB Output is correct
26 Correct 269 ms 502592 KB Output is correct
27 Correct 277 ms 498904 KB Output is correct
28 Correct 257 ms 498984 KB Output is correct
29 Correct 251 ms 498276 KB Output is correct
30 Correct 244 ms 498252 KB Output is correct
31 Correct 268 ms 498348 KB Output is correct
32 Correct 248 ms 498312 KB Output is correct
33 Correct 276 ms 500128 KB Output is correct
34 Correct 264 ms 500024 KB Output is correct
35 Correct 244 ms 500088 KB Output is correct
36 Correct 275 ms 500040 KB Output is correct
37 Correct 289 ms 500116 KB Output is correct
38 Correct 252 ms 500088 KB Output is correct
39 Correct 254 ms 502964 KB Output is correct
40 Correct 279 ms 503080 KB Output is correct
41 Correct 273 ms 503148 KB Output is correct
42 Correct 246 ms 498088 KB Output is correct
43 Correct 231 ms 498076 KB Output is correct
44 Correct 265 ms 498092 KB Output is correct
45 Correct 240 ms 498112 KB Output is correct
46 Correct 231 ms 498112 KB Output is correct
47 Correct 228 ms 498148 KB Output is correct
48 Correct 279 ms 498124 KB Output is correct
49 Correct 233 ms 498108 KB Output is correct
50 Correct 236 ms 498092 KB Output is correct
51 Correct 230 ms 498132 KB Output is correct
52 Correct 247 ms 498124 KB Output is correct
53 Correct 232 ms 498108 KB Output is correct
54 Correct 229 ms 498140 KB Output is correct
55 Correct 240 ms 498148 KB Output is correct
56 Correct 237 ms 498124 KB Output is correct
57 Correct 239 ms 498124 KB Output is correct
58 Correct 261 ms 498156 KB Output is correct
59 Correct 232 ms 498068 KB Output is correct
60 Correct 237 ms 498124 KB Output is correct
61 Correct 233 ms 498164 KB Output is correct
62 Correct 231 ms 498124 KB Output is correct
63 Correct 237 ms 498168 KB Output is correct
64 Correct 229 ms 498144 KB Output is correct
65 Correct 230 ms 498108 KB Output is correct
66 Correct 231 ms 498124 KB Output is correct
67 Correct 229 ms 498112 KB Output is correct
68 Correct 228 ms 498124 KB Output is correct
69 Correct 228 ms 498128 KB Output is correct
70 Correct 295 ms 498124 KB Output is correct
71 Correct 265 ms 498156 KB Output is correct
72 Correct 247 ms 498124 KB Output is correct
73 Correct 224 ms 498128 KB Output is correct
74 Correct 222 ms 498156 KB Output is correct
75 Correct 247 ms 498164 KB Output is correct
76 Correct 228 ms 498224 KB Output is correct
77 Correct 214 ms 498260 KB Output is correct
78 Correct 228 ms 498328 KB Output is correct
79 Correct 221 ms 498156 KB Output is correct
80 Correct 230 ms 498080 KB Output is correct
81 Correct 231 ms 498172 KB Output is correct
82 Correct 225 ms 498248 KB Output is correct
83 Correct 221 ms 498072 KB Output is correct
84 Correct 230 ms 498172 KB Output is correct
85 Correct 221 ms 498300 KB Output is correct
86 Correct 222 ms 498392 KB Output is correct
87 Correct 225 ms 498288 KB Output is correct
88 Correct 221 ms 498324 KB Output is correct
89 Correct 220 ms 498504 KB Output is correct
90 Correct 218 ms 498380 KB Output is correct
91 Correct 235 ms 501440 KB Output is correct
92 Correct 235 ms 501912 KB Output is correct
93 Correct 237 ms 502468 KB Output is correct
94 Correct 229 ms 498192 KB Output is correct
95 Correct 222 ms 498164 KB Output is correct
96 Correct 223 ms 498156 KB Output is correct
97 Correct 257 ms 498200 KB Output is correct
98 Correct 227 ms 498124 KB Output is correct
99 Correct 225 ms 498412 KB Output is correct
100 Correct 230 ms 498480 KB Output is correct
101 Correct 223 ms 498432 KB Output is correct
102 Correct 224 ms 498460 KB Output is correct
103 Correct 225 ms 498476 KB Output is correct
104 Correct 225 ms 498380 KB Output is correct
105 Correct 239 ms 502800 KB Output is correct
106 Correct 244 ms 502764 KB Output is correct
107 Correct 241 ms 502744 KB Output is correct
108 Correct 230 ms 498940 KB Output is correct
109 Correct 786 ms 498824 KB Output is correct
110 Correct 732 ms 498432 KB Output is correct
111 Correct 576 ms 498472 KB Output is correct
112 Correct 604 ms 498488 KB Output is correct
113 Correct 446 ms 498336 KB Output is correct
114 Correct 240 ms 500084 KB Output is correct
115 Correct 231 ms 499940 KB Output is correct
116 Correct 246 ms 500608 KB Output is correct
117 Correct 235 ms 500032 KB Output is correct
118 Correct 234 ms 500240 KB Output is correct
119 Correct 234 ms 499932 KB Output is correct
120 Correct 236 ms 501156 KB Output is correct
121 Correct 227 ms 499184 KB Output is correct
122 Correct 240 ms 501524 KB Output is correct
123 Correct 231 ms 499100 KB Output is correct
124 Correct 273 ms 502068 KB Output is correct
125 Correct 231 ms 499532 KB Output is correct
126 Correct 260 ms 499124 KB Output is correct
127 Correct 232 ms 499320 KB Output is correct
128 Correct 226 ms 499024 KB Output is correct
129 Correct 227 ms 499124 KB Output is correct
130 Correct 228 ms 498952 KB Output is correct
131 Correct 1004 ms 499148 KB Output is correct
132 Correct 1137 ms 498456 KB Output is correct
133 Correct 933 ms 498508 KB Output is correct
134 Correct 773 ms 498552 KB Output is correct
135 Correct 689 ms 498396 KB Output is correct
136 Correct 244 ms 500952 KB Output is correct
137 Correct 240 ms 500980 KB Output is correct
138 Correct 243 ms 500972 KB Output is correct
139 Correct 241 ms 500864 KB Output is correct
140 Correct 240 ms 500956 KB Output is correct
141 Correct 251 ms 501148 KB Output is correct
142 Correct 246 ms 503116 KB Output is correct
143 Correct 229 ms 499816 KB Output is correct
144 Correct 245 ms 503144 KB Output is correct
145 Correct 230 ms 499924 KB Output is correct
146 Correct 246 ms 503216 KB Output is correct
147 Correct 233 ms 499968 KB Output is correct
148 Correct 229 ms 499716 KB Output is correct
149 Correct 231 ms 499532 KB Output is correct
150 Correct 228 ms 499432 KB Output is correct
151 Correct 228 ms 499468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 262 ms 498040 KB Output is correct
2 Correct 263 ms 498084 KB Output is correct
3 Correct 221 ms 498236 KB Output is correct
4 Correct 222 ms 498132 KB Output is correct
5 Correct 228 ms 498124 KB Output is correct
6 Correct 224 ms 498044 KB Output is correct
7 Correct 283 ms 498132 KB Output is correct
8 Correct 232 ms 498152 KB Output is correct
9 Correct 279 ms 498124 KB Output is correct
10 Correct 228 ms 498140 KB Output is correct
11 Correct 254 ms 498088 KB Output is correct
12 Correct 255 ms 498084 KB Output is correct
13 Correct 244 ms 498088 KB Output is correct
14 Correct 262 ms 498120 KB Output is correct
15 Correct 253 ms 498132 KB Output is correct
16 Correct 247 ms 498136 KB Output is correct
17 Correct 245 ms 498104 KB Output is correct
18 Correct 247 ms 498156 KB Output is correct
19 Correct 263 ms 498180 KB Output is correct
20 Correct 256 ms 498196 KB Output is correct
21 Correct 264 ms 498132 KB Output is correct
22 Correct 278 ms 498112 KB Output is correct
23 Correct 240 ms 498168 KB Output is correct
24 Correct 250 ms 502612 KB Output is correct
25 Correct 250 ms 502628 KB Output is correct
26 Correct 269 ms 502592 KB Output is correct
27 Correct 277 ms 498904 KB Output is correct
28 Correct 257 ms 498984 KB Output is correct
29 Correct 251 ms 498276 KB Output is correct
30 Correct 244 ms 498252 KB Output is correct
31 Correct 268 ms 498348 KB Output is correct
32 Correct 248 ms 498312 KB Output is correct
33 Correct 276 ms 500128 KB Output is correct
34 Correct 264 ms 500024 KB Output is correct
35 Correct 244 ms 500088 KB Output is correct
36 Correct 275 ms 500040 KB Output is correct
37 Correct 289 ms 500116 KB Output is correct
38 Correct 252 ms 500088 KB Output is correct
39 Correct 254 ms 502964 KB Output is correct
40 Correct 279 ms 503080 KB Output is correct
41 Correct 273 ms 503148 KB Output is correct
42 Correct 264 ms 501916 KB Output is correct
43 Correct 247 ms 500536 KB Output is correct
44 Correct 264 ms 499140 KB Output is correct
45 Correct 251 ms 498860 KB Output is correct
46 Correct 241 ms 498728 KB Output is correct
47 Correct 239 ms 499196 KB Output is correct
48 Correct 295 ms 511624 KB Output is correct
49 Correct 276 ms 506016 KB Output is correct
50 Correct 273 ms 508292 KB Output is correct
51 Correct 276 ms 506764 KB Output is correct
52 Correct 264 ms 506316 KB Output is correct
53 Correct 282 ms 504192 KB Output is correct
54 Correct 258 ms 502308 KB Output is correct
55 Correct 259 ms 502348 KB Output is correct
56 Correct 265 ms 499348 KB Output is correct
57 Correct 291 ms 499172 KB Output is correct
58 Correct 271 ms 499128 KB Output is correct
59 Correct 297 ms 499148 KB Output is correct
60 Correct 303 ms 513096 KB Output is correct
61 Correct 314 ms 512988 KB Output is correct
62 Correct 293 ms 513004 KB Output is correct
63 Correct 299 ms 513012 KB Output is correct
64 Correct 309 ms 512968 KB Output is correct
65 Correct 315 ms 512944 KB Output is correct
66 Correct 282 ms 508332 KB Output is correct
67 Correct 279 ms 508400 KB Output is correct
68 Correct 279 ms 508360 KB Output is correct
69 Correct 246 ms 498088 KB Output is correct
70 Correct 231 ms 498076 KB Output is correct
71 Correct 265 ms 498092 KB Output is correct
72 Correct 240 ms 498112 KB Output is correct
73 Correct 231 ms 498112 KB Output is correct
74 Correct 228 ms 498148 KB Output is correct
75 Correct 279 ms 498124 KB Output is correct
76 Correct 233 ms 498108 KB Output is correct
77 Correct 236 ms 498092 KB Output is correct
78 Correct 230 ms 498132 KB Output is correct
79 Correct 247 ms 498124 KB Output is correct
80 Correct 232 ms 498108 KB Output is correct
81 Correct 229 ms 498140 KB Output is correct
82 Correct 240 ms 498148 KB Output is correct
83 Correct 237 ms 498124 KB Output is correct
84 Correct 239 ms 498124 KB Output is correct
85 Correct 261 ms 498156 KB Output is correct
86 Correct 232 ms 498068 KB Output is correct
87 Correct 237 ms 498124 KB Output is correct
88 Correct 233 ms 498164 KB Output is correct
89 Correct 231 ms 498124 KB Output is correct
90 Correct 237 ms 498168 KB Output is correct
91 Correct 229 ms 498144 KB Output is correct
92 Correct 230 ms 498108 KB Output is correct
93 Correct 231 ms 498124 KB Output is correct
94 Correct 229 ms 498112 KB Output is correct
95 Correct 228 ms 498124 KB Output is correct
96 Correct 228 ms 498128 KB Output is correct
97 Correct 295 ms 498124 KB Output is correct
98 Correct 265 ms 498156 KB Output is correct
99 Correct 247 ms 498124 KB Output is correct
100 Correct 224 ms 498128 KB Output is correct
101 Correct 222 ms 498156 KB Output is correct
102 Correct 247 ms 498164 KB Output is correct
103 Correct 228 ms 498224 KB Output is correct
104 Correct 214 ms 498260 KB Output is correct
105 Correct 228 ms 498328 KB Output is correct
106 Correct 221 ms 498156 KB Output is correct
107 Correct 230 ms 498080 KB Output is correct
108 Correct 231 ms 498172 KB Output is correct
109 Correct 225 ms 498248 KB Output is correct
110 Correct 221 ms 498072 KB Output is correct
111 Correct 230 ms 498172 KB Output is correct
112 Correct 221 ms 498300 KB Output is correct
113 Correct 222 ms 498392 KB Output is correct
114 Correct 225 ms 498288 KB Output is correct
115 Correct 221 ms 498324 KB Output is correct
116 Correct 220 ms 498504 KB Output is correct
117 Correct 218 ms 498380 KB Output is correct
118 Correct 235 ms 501440 KB Output is correct
119 Correct 235 ms 501912 KB Output is correct
120 Correct 237 ms 502468 KB Output is correct
121 Correct 229 ms 498192 KB Output is correct
122 Correct 222 ms 498164 KB Output is correct
123 Correct 223 ms 498156 KB Output is correct
124 Correct 257 ms 498200 KB Output is correct
125 Correct 227 ms 498124 KB Output is correct
126 Correct 225 ms 498412 KB Output is correct
127 Correct 230 ms 498480 KB Output is correct
128 Correct 223 ms 498432 KB Output is correct
129 Correct 224 ms 498460 KB Output is correct
130 Correct 225 ms 498476 KB Output is correct
131 Correct 225 ms 498380 KB Output is correct
132 Correct 239 ms 502800 KB Output is correct
133 Correct 244 ms 502764 KB Output is correct
134 Correct 241 ms 502744 KB Output is correct
135 Correct 230 ms 498940 KB Output is correct
136 Correct 786 ms 498824 KB Output is correct
137 Correct 732 ms 498432 KB Output is correct
138 Correct 576 ms 498472 KB Output is correct
139 Correct 604 ms 498488 KB Output is correct
140 Correct 446 ms 498336 KB Output is correct
141 Correct 240 ms 500084 KB Output is correct
142 Correct 231 ms 499940 KB Output is correct
143 Correct 246 ms 500608 KB Output is correct
144 Correct 235 ms 500032 KB Output is correct
145 Correct 234 ms 500240 KB Output is correct
146 Correct 234 ms 499932 KB Output is correct
147 Correct 236 ms 501156 KB Output is correct
148 Correct 227 ms 499184 KB Output is correct
149 Correct 240 ms 501524 KB Output is correct
150 Correct 231 ms 499100 KB Output is correct
151 Correct 273 ms 502068 KB Output is correct
152 Correct 231 ms 499532 KB Output is correct
153 Correct 260 ms 499124 KB Output is correct
154 Correct 232 ms 499320 KB Output is correct
155 Correct 226 ms 499024 KB Output is correct
156 Correct 227 ms 499124 KB Output is correct
157 Correct 228 ms 498952 KB Output is correct
158 Correct 1004 ms 499148 KB Output is correct
159 Correct 1137 ms 498456 KB Output is correct
160 Correct 933 ms 498508 KB Output is correct
161 Correct 773 ms 498552 KB Output is correct
162 Correct 689 ms 498396 KB Output is correct
163 Correct 244 ms 500952 KB Output is correct
164 Correct 240 ms 500980 KB Output is correct
165 Correct 243 ms 500972 KB Output is correct
166 Correct 241 ms 500864 KB Output is correct
167 Correct 240 ms 500956 KB Output is correct
168 Correct 251 ms 501148 KB Output is correct
169 Correct 246 ms 503116 KB Output is correct
170 Correct 229 ms 499816 KB Output is correct
171 Correct 245 ms 503144 KB Output is correct
172 Correct 230 ms 499924 KB Output is correct
173 Correct 246 ms 503216 KB Output is correct
174 Correct 233 ms 499968 KB Output is correct
175 Correct 229 ms 499716 KB Output is correct
176 Correct 231 ms 499532 KB Output is correct
177 Correct 228 ms 499432 KB Output is correct
178 Correct 228 ms 499468 KB Output is correct
179 Correct 244 ms 500684 KB Output is correct
180 Execution timed out 1607 ms 500340 KB Time limit exceeded
181 Halted 0 ms 0 KB -