#include<bits/stdc++.h>
using namespace std;
const int maxn = 5e5+5;
const int maxl = 25;
const int inf = 1e9;
#define pii array<int,2>
int par[2*maxn],lt[2*maxn],rt[2*maxn];
int findpar(int u){
if(u!=par[u]) return par[u]=findpar(par[u]);
return u;
}
void unions(int u,int v){
u=findpar(u);v=findpar(v);
if(u!=v) par[v]=u;
}
int L,R,n,m,q,sum[maxn],nxt[maxn],pre[maxn];
pii S[maxn][maxl];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
cin >> n >> m >> q;
for(int i=0;i<n*m;i++) par[i]=i,lt[i]=n,rt[i]=0;
for(int i=0;i<n;i++) for(int j=0;j<m-1;j++){
char C;cin >> C;
if(C=='1') unions(i*m+j,i*m+j+1);
}
for(int i=0;i<n-1;i++) for(int j=0;j<m;j++){
char C;cin >> C;
if(C=='1') unions(i*m+j,(i+1)*m+j);
}
for(int i=0;i<n;i++) for(int j=0;j<m;j++){
int p=findpar(i*m+j);
lt[p]=min(lt[p],i);
rt[p]=max(rt[p],i);
}
for(int i=0;i<n*m;i++){
if(lt[i]>rt[i]) continue;
nxt[lt[i]]=max(nxt[lt[i]],rt[i]);
//cout << "range " << lt[i] << ' ' << rt[i] << '\n';
}
for(int i=1;i<n;i++) nxt[i]=max({i,nxt[i],nxt[i-1]});
for(int i=1;i<n;i++){
if(nxt[i-1]<=i-1) sum[i]++;
sum[i]+=sum[i-1];
}
for(int i=0;i<n;i++){
int x;cin >> x;
pre[i]=(i?pre[i-1]:-1);
if(x==1) pre[i]=i;
}
for(int i=0;i<n;i++) S[i][0]={i,max(i,pre[nxt[i]])};
auto g = [&](int i,int j,int k){
if(i<0) return -1;
return S[i][j][k];
};
auto up = [&](int x){
if(x==-1) return -1;
else return max(x,nxt[x]);
};
for(int j=1;j<20;j++){
for(int i=0;i<n;i++){
S[i][j][0]=max(g(g(i,j-1,0),j-1,1),g(g(i,j-1,1),j-1,0));
S[i][j][1]=max({g(g(i,j-1,1),j-1,1),g(i,j,0),g(i,j,1),g(up(g(i,j-1,0)),j-1,0)});
}
}
while(q--){
int sz;cin >> sz;
vector<int> cc;
for(int i=0;i<sz;i++){
int x,y;cin >> x >> y;x--;y--;
x=findpar(x*m+y);
cc.push_back(x);
}
sort(cc.begin(),cc.end());
cc.erase(unique(cc.begin(),cc.end()),cc.end());
if((int)cc.size()==1){
cout << 0 << '\n';
continue;
}
vector<pii> a;
L=n,R=0;
for(int x:cc){
L=min(L,rt[x]);
R=max(R,lt[x]);
a.push_back({lt[x],rt[x]});
}
if(L<R && sum[R]-sum[L]>0){
cout << -1 << '\n';
continue;
}
sort(a.begin(),a.end(),[&](pii x,pii y){
return pii{x[0],-x[1]}<pii{y[0],-y[1]};
});
{
vector<pii> st;
for(pii x:a){
while(!st.empty() && st.back()[1]>=x[1]) st.pop_back();
st.push_back(x);
}
a=st;
}
auto f = [&](int p){
if(p==-1) return -1;
int pos=upper_bound(a.begin(),a.end(),pii{p,inf})-a.begin();
if(pos>0 && p<=a[pos-1][1]) return -1;
return pos;
};
int ans=1;
pii dp={-1,pre[L]};
while(dp[1]<R){
int t0=f(dp[0]),t1=f(dp[1]);
//cout << '*' << t0 << ' ' << t1 << '\n';
if(t0>=0 && t1>=0){
auto get = [&](pii a,int i){
int a0=g(a[0],i,1),a1=g(a[1],i,0);
int b0=g(up(a[0]),i,0),b1=g(a[1],i,1);
return pii{max(a0,a1),max({a0,a1,b0,b1})};
};
int mx=R,pos=t1;
if(pos<(int)a.size()) mx=min(mx,a[pos][0]);
for(int i=19;i>=0;i--){
auto [x,y]=get(dp,i);
if(x<mx && y<mx) dp={x,y},ans+=(1<<i);
}
}
if(dp[1]>=R) break;
auto jmp = [&](int x){
if(x==-1) return L;
int res=nxt[x];
int pos=upper_bound(a.begin(),a.end(),pii{x,inf})-a.begin();
if(pos<(int)a.size()) res=min(res,a[pos][1]);
return res;
};
pii ndp{dp[1],-1};
ndp[1]=max({pre[jmp(dp[1])],jmp(dp[0]),dp[1]});
ans++;dp=ndp;
//cout << '*' << dp[0] << ' ' << dp[1] << '\n';
}
cout << ans << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
215 ms |
115884 KB |
Output is correct |
14 |
Correct |
64 ms |
40528 KB |
Output is correct |
15 |
Correct |
43 ms |
13144 KB |
Output is correct |
16 |
Correct |
28 ms |
13144 KB |
Output is correct |
17 |
Correct |
29 ms |
13148 KB |
Output is correct |
18 |
Correct |
185 ms |
115800 KB |
Output is correct |
19 |
Correct |
175 ms |
116048 KB |
Output is correct |
20 |
Correct |
19 ms |
13148 KB |
Output is correct |
21 |
Correct |
116 ms |
82000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
215 ms |
115884 KB |
Output is correct |
14 |
Correct |
64 ms |
40528 KB |
Output is correct |
15 |
Correct |
43 ms |
13144 KB |
Output is correct |
16 |
Correct |
28 ms |
13144 KB |
Output is correct |
17 |
Correct |
29 ms |
13148 KB |
Output is correct |
18 |
Correct |
185 ms |
115800 KB |
Output is correct |
19 |
Correct |
175 ms |
116048 KB |
Output is correct |
20 |
Correct |
19 ms |
13148 KB |
Output is correct |
21 |
Correct |
116 ms |
82000 KB |
Output is correct |
22 |
Correct |
0 ms |
2396 KB |
Output is correct |
23 |
Correct |
192 ms |
115864 KB |
Output is correct |
24 |
Correct |
151 ms |
84296 KB |
Output is correct |
25 |
Correct |
70 ms |
13180 KB |
Output is correct |
26 |
Correct |
42 ms |
13304 KB |
Output is correct |
27 |
Correct |
78 ms |
13496 KB |
Output is correct |
28 |
Correct |
229 ms |
116836 KB |
Output is correct |
29 |
Correct |
198 ms |
117012 KB |
Output is correct |
30 |
Correct |
184 ms |
117068 KB |
Output is correct |
31 |
Correct |
180 ms |
115796 KB |
Output is correct |
32 |
Correct |
210 ms |
118868 KB |
Output is correct |
33 |
Correct |
62 ms |
14304 KB |
Output is correct |
34 |
Correct |
130 ms |
81992 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
215 ms |
115884 KB |
Output is correct |
14 |
Correct |
64 ms |
40528 KB |
Output is correct |
15 |
Correct |
43 ms |
13144 KB |
Output is correct |
16 |
Correct |
28 ms |
13144 KB |
Output is correct |
17 |
Correct |
29 ms |
13148 KB |
Output is correct |
18 |
Correct |
185 ms |
115800 KB |
Output is correct |
19 |
Correct |
175 ms |
116048 KB |
Output is correct |
20 |
Correct |
19 ms |
13148 KB |
Output is correct |
21 |
Correct |
116 ms |
82000 KB |
Output is correct |
22 |
Correct |
454 ms |
116516 KB |
Output is correct |
23 |
Correct |
249 ms |
116568 KB |
Output is correct |
24 |
Correct |
120 ms |
39244 KB |
Output is correct |
25 |
Correct |
89 ms |
13348 KB |
Output is correct |
26 |
Correct |
114 ms |
13576 KB |
Output is correct |
27 |
Correct |
97 ms |
13652 KB |
Output is correct |
28 |
Correct |
56 ms |
13400 KB |
Output is correct |
29 |
Correct |
227 ms |
116052 KB |
Output is correct |
30 |
Correct |
213 ms |
116092 KB |
Output is correct |
31 |
Correct |
228 ms |
116060 KB |
Output is correct |
32 |
Correct |
228 ms |
116052 KB |
Output is correct |
33 |
Correct |
69 ms |
13224 KB |
Output is correct |
34 |
Correct |
260 ms |
82304 KB |
Output is correct |
35 |
Correct |
226 ms |
65364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
215 ms |
115884 KB |
Output is correct |
14 |
Correct |
64 ms |
40528 KB |
Output is correct |
15 |
Correct |
43 ms |
13144 KB |
Output is correct |
16 |
Correct |
28 ms |
13144 KB |
Output is correct |
17 |
Correct |
29 ms |
13148 KB |
Output is correct |
18 |
Correct |
185 ms |
115800 KB |
Output is correct |
19 |
Correct |
175 ms |
116048 KB |
Output is correct |
20 |
Correct |
19 ms |
13148 KB |
Output is correct |
21 |
Correct |
116 ms |
82000 KB |
Output is correct |
22 |
Correct |
0 ms |
2396 KB |
Output is correct |
23 |
Correct |
192 ms |
115864 KB |
Output is correct |
24 |
Correct |
151 ms |
84296 KB |
Output is correct |
25 |
Correct |
70 ms |
13180 KB |
Output is correct |
26 |
Correct |
42 ms |
13304 KB |
Output is correct |
27 |
Correct |
78 ms |
13496 KB |
Output is correct |
28 |
Correct |
229 ms |
116836 KB |
Output is correct |
29 |
Correct |
198 ms |
117012 KB |
Output is correct |
30 |
Correct |
184 ms |
117068 KB |
Output is correct |
31 |
Correct |
180 ms |
115796 KB |
Output is correct |
32 |
Correct |
210 ms |
118868 KB |
Output is correct |
33 |
Correct |
62 ms |
14304 KB |
Output is correct |
34 |
Correct |
130 ms |
81992 KB |
Output is correct |
35 |
Correct |
454 ms |
116516 KB |
Output is correct |
36 |
Correct |
249 ms |
116568 KB |
Output is correct |
37 |
Correct |
120 ms |
39244 KB |
Output is correct |
38 |
Correct |
89 ms |
13348 KB |
Output is correct |
39 |
Correct |
114 ms |
13576 KB |
Output is correct |
40 |
Correct |
97 ms |
13652 KB |
Output is correct |
41 |
Correct |
56 ms |
13400 KB |
Output is correct |
42 |
Correct |
227 ms |
116052 KB |
Output is correct |
43 |
Correct |
213 ms |
116092 KB |
Output is correct |
44 |
Correct |
228 ms |
116060 KB |
Output is correct |
45 |
Correct |
228 ms |
116052 KB |
Output is correct |
46 |
Correct |
69 ms |
13224 KB |
Output is correct |
47 |
Correct |
260 ms |
82304 KB |
Output is correct |
48 |
Correct |
226 ms |
65364 KB |
Output is correct |
49 |
Correct |
488 ms |
116268 KB |
Output is correct |
50 |
Correct |
390 ms |
116240 KB |
Output is correct |
51 |
Correct |
118 ms |
38992 KB |
Output is correct |
52 |
Correct |
68 ms |
16312 KB |
Output is correct |
53 |
Correct |
67 ms |
14928 KB |
Output is correct |
54 |
Correct |
85 ms |
14456 KB |
Output is correct |
55 |
Correct |
225 ms |
118592 KB |
Output is correct |
56 |
Correct |
209 ms |
116844 KB |
Output is correct |
57 |
Correct |
197 ms |
117996 KB |
Output is correct |
58 |
Correct |
227 ms |
116000 KB |
Output is correct |
59 |
Correct |
59 ms |
14260 KB |
Output is correct |
60 |
Correct |
337 ms |
82332 KB |
Output is correct |
61 |
Correct |
265 ms |
65360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
215 ms |
115884 KB |
Output is correct |
14 |
Correct |
64 ms |
40528 KB |
Output is correct |
15 |
Correct |
43 ms |
13144 KB |
Output is correct |
16 |
Correct |
28 ms |
13144 KB |
Output is correct |
17 |
Correct |
29 ms |
13148 KB |
Output is correct |
18 |
Correct |
185 ms |
115800 KB |
Output is correct |
19 |
Correct |
175 ms |
116048 KB |
Output is correct |
20 |
Correct |
19 ms |
13148 KB |
Output is correct |
21 |
Correct |
116 ms |
82000 KB |
Output is correct |
22 |
Correct |
0 ms |
2396 KB |
Output is correct |
23 |
Correct |
192 ms |
115864 KB |
Output is correct |
24 |
Correct |
151 ms |
84296 KB |
Output is correct |
25 |
Correct |
70 ms |
13180 KB |
Output is correct |
26 |
Correct |
42 ms |
13304 KB |
Output is correct |
27 |
Correct |
78 ms |
13496 KB |
Output is correct |
28 |
Correct |
229 ms |
116836 KB |
Output is correct |
29 |
Correct |
198 ms |
117012 KB |
Output is correct |
30 |
Correct |
184 ms |
117068 KB |
Output is correct |
31 |
Correct |
180 ms |
115796 KB |
Output is correct |
32 |
Correct |
210 ms |
118868 KB |
Output is correct |
33 |
Correct |
62 ms |
14304 KB |
Output is correct |
34 |
Correct |
130 ms |
81992 KB |
Output is correct |
35 |
Correct |
1 ms |
2396 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
216 ms |
119324 KB |
Output is correct |
38 |
Correct |
201 ms |
119232 KB |
Output is correct |
39 |
Correct |
181 ms |
119124 KB |
Output is correct |
40 |
Correct |
125 ms |
61704 KB |
Output is correct |
41 |
Correct |
59 ms |
18588 KB |
Output is correct |
42 |
Correct |
83 ms |
17744 KB |
Output is correct |
43 |
Correct |
231 ms |
121416 KB |
Output is correct |
44 |
Correct |
233 ms |
123012 KB |
Output is correct |
45 |
Correct |
217 ms |
123448 KB |
Output is correct |
46 |
Correct |
195 ms |
119240 KB |
Output is correct |
47 |
Correct |
230 ms |
123824 KB |
Output is correct |
48 |
Correct |
212 ms |
120576 KB |
Output is correct |
49 |
Correct |
61 ms |
17276 KB |
Output is correct |
50 |
Correct |
143 ms |
84936 KB |
Output is correct |
51 |
Correct |
135 ms |
84816 KB |
Output is correct |
52 |
Correct |
92 ms |
67664 KB |
Output is correct |
53 |
Correct |
95 ms |
67664 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
215 ms |
115884 KB |
Output is correct |
14 |
Correct |
64 ms |
40528 KB |
Output is correct |
15 |
Correct |
43 ms |
13144 KB |
Output is correct |
16 |
Correct |
28 ms |
13144 KB |
Output is correct |
17 |
Correct |
29 ms |
13148 KB |
Output is correct |
18 |
Correct |
185 ms |
115800 KB |
Output is correct |
19 |
Correct |
175 ms |
116048 KB |
Output is correct |
20 |
Correct |
19 ms |
13148 KB |
Output is correct |
21 |
Correct |
116 ms |
82000 KB |
Output is correct |
22 |
Correct |
454 ms |
116516 KB |
Output is correct |
23 |
Correct |
249 ms |
116568 KB |
Output is correct |
24 |
Correct |
120 ms |
39244 KB |
Output is correct |
25 |
Correct |
89 ms |
13348 KB |
Output is correct |
26 |
Correct |
114 ms |
13576 KB |
Output is correct |
27 |
Correct |
97 ms |
13652 KB |
Output is correct |
28 |
Correct |
56 ms |
13400 KB |
Output is correct |
29 |
Correct |
227 ms |
116052 KB |
Output is correct |
30 |
Correct |
213 ms |
116092 KB |
Output is correct |
31 |
Correct |
228 ms |
116060 KB |
Output is correct |
32 |
Correct |
228 ms |
116052 KB |
Output is correct |
33 |
Correct |
69 ms |
13224 KB |
Output is correct |
34 |
Correct |
260 ms |
82304 KB |
Output is correct |
35 |
Correct |
226 ms |
65364 KB |
Output is correct |
36 |
Correct |
1 ms |
2396 KB |
Output is correct |
37 |
Correct |
140 ms |
84112 KB |
Output is correct |
38 |
Correct |
93 ms |
67668 KB |
Output is correct |
39 |
Correct |
432 ms |
121656 KB |
Output is correct |
40 |
Correct |
247 ms |
121424 KB |
Output is correct |
41 |
Correct |
250 ms |
121428 KB |
Output is correct |
42 |
Correct |
146 ms |
43520 KB |
Output is correct |
43 |
Correct |
94 ms |
17100 KB |
Output is correct |
44 |
Correct |
108 ms |
17232 KB |
Output is correct |
45 |
Correct |
100 ms |
17212 KB |
Output is correct |
46 |
Correct |
57 ms |
17236 KB |
Output is correct |
47 |
Correct |
204 ms |
121448 KB |
Output is correct |
48 |
Correct |
218 ms |
121488 KB |
Output is correct |
49 |
Correct |
243 ms |
121428 KB |
Output is correct |
50 |
Correct |
211 ms |
121532 KB |
Output is correct |
51 |
Correct |
62 ms |
16720 KB |
Output is correct |
52 |
Correct |
215 ms |
121428 KB |
Output is correct |
53 |
Correct |
268 ms |
87136 KB |
Output is correct |
54 |
Correct |
220 ms |
69832 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4440 KB |
Output is correct |
2 |
Correct |
190 ms |
115796 KB |
Output is correct |
3 |
Correct |
17 ms |
12120 KB |
Output is correct |
4 |
Correct |
22 ms |
12380 KB |
Output is correct |
5 |
Correct |
40 ms |
12384 KB |
Output is correct |
6 |
Correct |
31 ms |
12204 KB |
Output is correct |
7 |
Correct |
169 ms |
115732 KB |
Output is correct |
8 |
Correct |
213 ms |
115792 KB |
Output is correct |
9 |
Correct |
199 ms |
115876 KB |
Output is correct |
10 |
Correct |
21 ms |
13144 KB |
Output is correct |
11 |
Correct |
134 ms |
81748 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
215 ms |
115884 KB |
Output is correct |
14 |
Correct |
64 ms |
40528 KB |
Output is correct |
15 |
Correct |
43 ms |
13144 KB |
Output is correct |
16 |
Correct |
28 ms |
13144 KB |
Output is correct |
17 |
Correct |
29 ms |
13148 KB |
Output is correct |
18 |
Correct |
185 ms |
115800 KB |
Output is correct |
19 |
Correct |
175 ms |
116048 KB |
Output is correct |
20 |
Correct |
19 ms |
13148 KB |
Output is correct |
21 |
Correct |
116 ms |
82000 KB |
Output is correct |
22 |
Correct |
0 ms |
2396 KB |
Output is correct |
23 |
Correct |
192 ms |
115864 KB |
Output is correct |
24 |
Correct |
151 ms |
84296 KB |
Output is correct |
25 |
Correct |
70 ms |
13180 KB |
Output is correct |
26 |
Correct |
42 ms |
13304 KB |
Output is correct |
27 |
Correct |
78 ms |
13496 KB |
Output is correct |
28 |
Correct |
229 ms |
116836 KB |
Output is correct |
29 |
Correct |
198 ms |
117012 KB |
Output is correct |
30 |
Correct |
184 ms |
117068 KB |
Output is correct |
31 |
Correct |
180 ms |
115796 KB |
Output is correct |
32 |
Correct |
210 ms |
118868 KB |
Output is correct |
33 |
Correct |
62 ms |
14304 KB |
Output is correct |
34 |
Correct |
130 ms |
81992 KB |
Output is correct |
35 |
Correct |
454 ms |
116516 KB |
Output is correct |
36 |
Correct |
249 ms |
116568 KB |
Output is correct |
37 |
Correct |
120 ms |
39244 KB |
Output is correct |
38 |
Correct |
89 ms |
13348 KB |
Output is correct |
39 |
Correct |
114 ms |
13576 KB |
Output is correct |
40 |
Correct |
97 ms |
13652 KB |
Output is correct |
41 |
Correct |
56 ms |
13400 KB |
Output is correct |
42 |
Correct |
227 ms |
116052 KB |
Output is correct |
43 |
Correct |
213 ms |
116092 KB |
Output is correct |
44 |
Correct |
228 ms |
116060 KB |
Output is correct |
45 |
Correct |
228 ms |
116052 KB |
Output is correct |
46 |
Correct |
69 ms |
13224 KB |
Output is correct |
47 |
Correct |
260 ms |
82304 KB |
Output is correct |
48 |
Correct |
226 ms |
65364 KB |
Output is correct |
49 |
Correct |
488 ms |
116268 KB |
Output is correct |
50 |
Correct |
390 ms |
116240 KB |
Output is correct |
51 |
Correct |
118 ms |
38992 KB |
Output is correct |
52 |
Correct |
68 ms |
16312 KB |
Output is correct |
53 |
Correct |
67 ms |
14928 KB |
Output is correct |
54 |
Correct |
85 ms |
14456 KB |
Output is correct |
55 |
Correct |
225 ms |
118592 KB |
Output is correct |
56 |
Correct |
209 ms |
116844 KB |
Output is correct |
57 |
Correct |
197 ms |
117996 KB |
Output is correct |
58 |
Correct |
227 ms |
116000 KB |
Output is correct |
59 |
Correct |
59 ms |
14260 KB |
Output is correct |
60 |
Correct |
337 ms |
82332 KB |
Output is correct |
61 |
Correct |
265 ms |
65360 KB |
Output is correct |
62 |
Correct |
1 ms |
2396 KB |
Output is correct |
63 |
Correct |
1 ms |
348 KB |
Output is correct |
64 |
Correct |
216 ms |
119324 KB |
Output is correct |
65 |
Correct |
201 ms |
119232 KB |
Output is correct |
66 |
Correct |
181 ms |
119124 KB |
Output is correct |
67 |
Correct |
125 ms |
61704 KB |
Output is correct |
68 |
Correct |
59 ms |
18588 KB |
Output is correct |
69 |
Correct |
83 ms |
17744 KB |
Output is correct |
70 |
Correct |
231 ms |
121416 KB |
Output is correct |
71 |
Correct |
233 ms |
123012 KB |
Output is correct |
72 |
Correct |
217 ms |
123448 KB |
Output is correct |
73 |
Correct |
195 ms |
119240 KB |
Output is correct |
74 |
Correct |
230 ms |
123824 KB |
Output is correct |
75 |
Correct |
212 ms |
120576 KB |
Output is correct |
76 |
Correct |
61 ms |
17276 KB |
Output is correct |
77 |
Correct |
143 ms |
84936 KB |
Output is correct |
78 |
Correct |
135 ms |
84816 KB |
Output is correct |
79 |
Correct |
92 ms |
67664 KB |
Output is correct |
80 |
Correct |
95 ms |
67664 KB |
Output is correct |
81 |
Correct |
1 ms |
2396 KB |
Output is correct |
82 |
Correct |
140 ms |
84112 KB |
Output is correct |
83 |
Correct |
93 ms |
67668 KB |
Output is correct |
84 |
Correct |
432 ms |
121656 KB |
Output is correct |
85 |
Correct |
247 ms |
121424 KB |
Output is correct |
86 |
Correct |
250 ms |
121428 KB |
Output is correct |
87 |
Correct |
146 ms |
43520 KB |
Output is correct |
88 |
Correct |
94 ms |
17100 KB |
Output is correct |
89 |
Correct |
108 ms |
17232 KB |
Output is correct |
90 |
Correct |
100 ms |
17212 KB |
Output is correct |
91 |
Correct |
57 ms |
17236 KB |
Output is correct |
92 |
Correct |
204 ms |
121448 KB |
Output is correct |
93 |
Correct |
218 ms |
121488 KB |
Output is correct |
94 |
Correct |
243 ms |
121428 KB |
Output is correct |
95 |
Correct |
211 ms |
121532 KB |
Output is correct |
96 |
Correct |
62 ms |
16720 KB |
Output is correct |
97 |
Correct |
215 ms |
121428 KB |
Output is correct |
98 |
Correct |
268 ms |
87136 KB |
Output is correct |
99 |
Correct |
220 ms |
69832 KB |
Output is correct |
100 |
Correct |
491 ms |
121512 KB |
Output is correct |
101 |
Correct |
417 ms |
121168 KB |
Output is correct |
102 |
Correct |
386 ms |
121168 KB |
Output is correct |
103 |
Correct |
123 ms |
43092 KB |
Output is correct |
104 |
Correct |
80 ms |
33316 KB |
Output is correct |
105 |
Correct |
65 ms |
17860 KB |
Output is correct |
106 |
Correct |
78 ms |
18596 KB |
Output is correct |
107 |
Correct |
207 ms |
121576 KB |
Output is correct |
108 |
Correct |
197 ms |
123764 KB |
Output is correct |
109 |
Correct |
211 ms |
121928 KB |
Output is correct |
110 |
Correct |
221 ms |
121280 KB |
Output is correct |
111 |
Correct |
218 ms |
122028 KB |
Output is correct |
112 |
Correct |
62 ms |
17684 KB |
Output is correct |
113 |
Correct |
332 ms |
86900 KB |
Output is correct |
114 |
Correct |
270 ms |
69720 KB |
Output is correct |