Submission #924175

# Submission time Handle Problem Language Result Execution time Memory
924175 2024-02-08T15:52:20 Z vjudge1 Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 895660 KB
#include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(ll i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define imp(v) for(auto edu:v)cout<<edu<<" "; cout<<"\n"
using namespace std;
typedef int ll;
typedef pair<ll,ll> ii;
#pragma GCC optimize("Ofast") // may lead to precision errors

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
const ll MAXN=6e6+5;

ll a[MAXN];
ll n,m,k;
inline ll cv(ii x){return m*x.fst+x.snd;}
inline ii cv(ll x){return {x/m,x%m};}
vector<ll>dir;
//vector<ii>diir={{0,1},{-1,0},{0,-1},{1,0}};
//ii operator+(ii a, ii b){return {a.fst+b.fst,a.snd+b.snd};}
//void operator+=(ii &a, ii b){a=a+b;}
bool allowed(ll x, ll w){
	auto [i,j]=cv(x);
	if(w==0&&j>=m-1)return 0;
	if(w==1&&i<=0)return 0;
	if(w==2&&j<=0)return 0;
	if(w==3&&i>=n-1)return 0;
	return 1;
}
ll d[MAXN],vis[MAXN];
deque<pair<ll,bool>>q;
set<ll>r[MAXN],c[MAXN];
vector<ll>pop;
void go(ll x, ll y, ll g){
	if(vis[y])return;
	d[y]=d[x]+g;
	q.push_front({y,0});
	vis[y]=1;
	pop.pb(y);
}
void popit(){
	for(auto x:pop){
		auto [i,j]=cv(x);
		r[i].erase(j);
		c[j].erase(i);
	}
	pop.clear();
}
ll reach(ll _x, ll _e){
	ii x=cv(_x),e=cv(_e);
	return (max(abs(x.fst-e.fst),abs(x.snd-e.snd))<=k&&
	       abs(x.fst-e.fst)+abs(x.snd-e.snd)<2*k);
}

ll bfs(ll s, ll e){
	mset(d,-1);
	d[s]=0;
	q.push_front({s,0});
	while(SZ(q)){
		auto [x,g]=q.front(); q.pop_front();
		if(!g){
			fore(w,0,4){
				auto y=x+dir[w];
				if(!allowed(x,w)||(!g&&a[y]))continue;
				go(x,y,0);
				popit();
			}
			q.pb({x,1});
		}
		else {
			auto [i,j]=cv(x);
			if(reach(x,e))go(x,e,1);
			if(i-k>=0)
				for(auto it=r[i-k].upper_bound(j-k);
				it!=r[i-k].end()&&*it<j+k;it++)go(x,cv({i-k,*it}),1);
			if(i+k<n)
				for(auto it=r[i+k].upper_bound(j-k);
				it!=r[i+k].end()&&*it<j+k;it++)go(x,cv({i+k,*it}),1);
			if(j-k>=0)
				for(auto it=c[j-k].upper_bound(i-k);
				it!=c[j-k].end()&&*it<i+k;it++)go(x,cv({*it,j-k}),1);
			if(j+k<m)
				for(auto it=c[j+k].upper_bound(i-k);
				it!=c[j+k].end()&&*it<i+k;it++)go(x,cv({*it,j+k}),1);
			popit();
		}
	}
	return d[e];
}

int main(){FIN;
	cin>>n>>m>>k;
	dir={1,-m,-1,m};
	ii s,e; cin>>s.fst>>s.snd>>e.fst>>e.snd; s.fst--,s.snd--,e.fst--,e.snd--;
	fore(i,0,n*m){
		char c; cin>>c;
		a[i]=(c=='#');
	}
	fore(i,0,n)fore(j,0,m)r[i].insert(j),c[j].insert(i);
	cout<<bfs(cv(s),cv(e))<<"\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 213 ms 589396 KB Output is correct
2 Correct 139 ms 589528 KB Output is correct
3 Correct 139 ms 589392 KB Output is correct
4 Correct 133 ms 589584 KB Output is correct
5 Correct 140 ms 589400 KB Output is correct
6 Correct 137 ms 589388 KB Output is correct
7 Correct 136 ms 589480 KB Output is correct
8 Correct 143 ms 589756 KB Output is correct
9 Correct 132 ms 589252 KB Output is correct
10 Correct 134 ms 589392 KB Output is correct
11 Correct 137 ms 589396 KB Output is correct
12 Correct 132 ms 589320 KB Output is correct
13 Correct 137 ms 589396 KB Output is correct
14 Correct 133 ms 589396 KB Output is correct
15 Correct 136 ms 589392 KB Output is correct
16 Correct 137 ms 589588 KB Output is correct
17 Correct 140 ms 589780 KB Output is correct
18 Correct 137 ms 589396 KB Output is correct
19 Correct 163 ms 595084 KB Output is correct
20 Correct 151 ms 593748 KB Output is correct
21 Correct 157 ms 595024 KB Output is correct
22 Correct 162 ms 595140 KB Output is correct
23 Correct 155 ms 595028 KB Output is correct
24 Correct 152 ms 595100 KB Output is correct
25 Correct 151 ms 595148 KB Output is correct
26 Correct 165 ms 594896 KB Output is correct
27 Correct 170 ms 595324 KB Output is correct
28 Correct 159 ms 595012 KB Output is correct
29 Correct 218 ms 603476 KB Output is correct
30 Correct 165 ms 595268 KB Output is correct
31 Correct 196 ms 603472 KB Output is correct
32 Correct 210 ms 603476 KB Output is correct
33 Correct 205 ms 603532 KB Output is correct
34 Correct 187 ms 603732 KB Output is correct
35 Correct 186 ms 603472 KB Output is correct
36 Correct 216 ms 603472 KB Output is correct
37 Correct 215 ms 603728 KB Output is correct
38 Correct 202 ms 603544 KB Output is correct
39 Correct 1060 ms 740108 KB Output is correct
40 Correct 221 ms 605664 KB Output is correct
41 Correct 197 ms 606800 KB Output is correct
42 Correct 242 ms 609628 KB Output is correct
43 Correct 244 ms 612176 KB Output is correct
44 Correct 618 ms 662912 KB Output is correct
45 Correct 604 ms 669012 KB Output is correct
46 Correct 962 ms 741964 KB Output is correct
47 Correct 1047 ms 740124 KB Output is correct
48 Correct 1102 ms 740136 KB Output is correct
49 Correct 762 ms 740180 KB Output is correct
50 Correct 842 ms 740184 KB Output is correct
51 Correct 1354 ms 740388 KB Output is correct
52 Correct 1411 ms 741384 KB Output is correct
53 Correct 1365 ms 740140 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 188 ms 589492 KB Output is correct
2 Correct 136 ms 589420 KB Output is correct
3 Correct 158 ms 587344 KB Output is correct
4 Correct 221 ms 589496 KB Output is correct
5 Correct 197 ms 589596 KB Output is correct
6 Correct 135 ms 589392 KB Output is correct
7 Correct 173 ms 589500 KB Output is correct
8 Correct 240 ms 587564 KB Output is correct
9 Correct 232 ms 587548 KB Output is correct
10 Correct 237 ms 587600 KB Output is correct
11 Correct 198 ms 589652 KB Output is correct
12 Correct 159 ms 589380 KB Output is correct
13 Correct 139 ms 589508 KB Output is correct
14 Correct 177 ms 589392 KB Output is correct
15 Correct 224 ms 587672 KB Output is correct
16 Correct 189 ms 589396 KB Output is correct
17 Correct 186 ms 589392 KB Output is correct
18 Correct 137 ms 589384 KB Output is correct
19 Correct 222 ms 589556 KB Output is correct
20 Correct 188 ms 589436 KB Output is correct
21 Correct 190 ms 589596 KB Output is correct
22 Correct 183 ms 589392 KB Output is correct
23 Correct 179 ms 589652 KB Output is correct
24 Correct 140 ms 589460 KB Output is correct
25 Correct 231 ms 589336 KB Output is correct
26 Correct 225 ms 589392 KB Output is correct
27 Correct 227 ms 589392 KB Output is correct
28 Correct 135 ms 589388 KB Output is correct
29 Correct 255 ms 587544 KB Output is correct
30 Correct 241 ms 587700 KB Output is correct
31 Correct 234 ms 587600 KB Output is correct
32 Correct 189 ms 589596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 191 ms 589468 KB Output is correct
2 Correct 136 ms 589380 KB Output is correct
3 Correct 246 ms 587344 KB Output is correct
4 Correct 234 ms 587388 KB Output is correct
5 Correct 228 ms 589400 KB Output is correct
6 Correct 217 ms 589396 KB Output is correct
7 Correct 217 ms 589592 KB Output is correct
8 Correct 216 ms 589380 KB Output is correct
9 Correct 198 ms 589396 KB Output is correct
10 Correct 182 ms 589392 KB Output is correct
11 Correct 182 ms 589648 KB Output is correct
12 Correct 182 ms 589392 KB Output is correct
13 Correct 145 ms 589444 KB Output is correct
14 Correct 204 ms 589488 KB Output is correct
15 Correct 197 ms 589396 KB Output is correct
16 Correct 201 ms 589560 KB Output is correct
17 Correct 198 ms 589456 KB Output is correct
18 Correct 139 ms 589360 KB Output is correct
19 Correct 148 ms 587568 KB Output is correct
20 Correct 183 ms 589388 KB Output is correct
21 Correct 199 ms 589500 KB Output is correct
22 Correct 200 ms 589384 KB Output is correct
23 Correct 198 ms 589580 KB Output is correct
24 Correct 200 ms 589720 KB Output is correct
25 Correct 212 ms 592980 KB Output is correct
26 Correct 220 ms 594496 KB Output is correct
27 Correct 226 ms 595024 KB Output is correct
28 Correct 214 ms 595028 KB Output is correct
29 Correct 220 ms 595028 KB Output is correct
30 Correct 234 ms 595028 KB Output is correct
31 Correct 183 ms 594908 KB Output is correct
32 Correct 208 ms 595076 KB Output is correct
33 Correct 220 ms 595124 KB Output is correct
34 Correct 248 ms 600756 KB Output is correct
35 Correct 275 ms 603632 KB Output is correct
36 Correct 197 ms 602816 KB Output is correct
37 Correct 192 ms 603728 KB Output is correct
38 Correct 182 ms 603512 KB Output is correct
39 Correct 447 ms 633548 KB Output is correct
40 Correct 1072 ms 717128 KB Output is correct
41 Correct 1063 ms 740560 KB Output is correct
42 Correct 979 ms 742032 KB Output is correct
43 Correct 718 ms 735236 KB Output is correct
44 Correct 704 ms 735128 KB Output is correct
45 Correct 1232 ms 740472 KB Output is correct
46 Correct 1251 ms 740700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 188 ms 589492 KB Output is correct
2 Correct 136 ms 589420 KB Output is correct
3 Correct 158 ms 587344 KB Output is correct
4 Correct 221 ms 589496 KB Output is correct
5 Correct 197 ms 589596 KB Output is correct
6 Correct 135 ms 589392 KB Output is correct
7 Correct 173 ms 589500 KB Output is correct
8 Correct 240 ms 587564 KB Output is correct
9 Correct 232 ms 587548 KB Output is correct
10 Correct 237 ms 587600 KB Output is correct
11 Correct 198 ms 589652 KB Output is correct
12 Correct 159 ms 589380 KB Output is correct
13 Correct 139 ms 589508 KB Output is correct
14 Correct 177 ms 589392 KB Output is correct
15 Correct 224 ms 587672 KB Output is correct
16 Correct 189 ms 589396 KB Output is correct
17 Correct 186 ms 589392 KB Output is correct
18 Correct 137 ms 589384 KB Output is correct
19 Correct 222 ms 589556 KB Output is correct
20 Correct 188 ms 589436 KB Output is correct
21 Correct 190 ms 589596 KB Output is correct
22 Correct 183 ms 589392 KB Output is correct
23 Correct 179 ms 589652 KB Output is correct
24 Correct 140 ms 589460 KB Output is correct
25 Correct 231 ms 589336 KB Output is correct
26 Correct 225 ms 589392 KB Output is correct
27 Correct 227 ms 589392 KB Output is correct
28 Correct 135 ms 589388 KB Output is correct
29 Correct 255 ms 587544 KB Output is correct
30 Correct 241 ms 587700 KB Output is correct
31 Correct 234 ms 587600 KB Output is correct
32 Correct 189 ms 589596 KB Output is correct
33 Correct 221 ms 595088 KB Output is correct
34 Correct 134 ms 589712 KB Output is correct
35 Correct 138 ms 587932 KB Output is correct
36 Correct 156 ms 592980 KB Output is correct
37 Correct 150 ms 592044 KB Output is correct
38 Correct 187 ms 594556 KB Output is correct
39 Correct 177 ms 595028 KB Output is correct
40 Correct 191 ms 595300 KB Output is correct
41 Correct 230 ms 595124 KB Output is correct
42 Correct 217 ms 595148 KB Output is correct
43 Correct 250 ms 595040 KB Output is correct
44 Correct 227 ms 595116 KB Output is correct
45 Correct 225 ms 595140 KB Output is correct
46 Correct 228 ms 595268 KB Output is correct
47 Correct 247 ms 595140 KB Output is correct
48 Correct 220 ms 594940 KB Output is correct
49 Correct 246 ms 594908 KB Output is correct
50 Correct 154 ms 595148 KB Output is correct
51 Correct 177 ms 593480 KB Output is correct
52 Correct 189 ms 593488 KB Output is correct
53 Correct 219 ms 593488 KB Output is correct
54 Correct 215 ms 594496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 188 ms 589492 KB Output is correct
2 Correct 136 ms 589420 KB Output is correct
3 Correct 158 ms 587344 KB Output is correct
4 Correct 221 ms 589496 KB Output is correct
5 Correct 197 ms 589596 KB Output is correct
6 Correct 135 ms 589392 KB Output is correct
7 Correct 173 ms 589500 KB Output is correct
8 Correct 240 ms 587564 KB Output is correct
9 Correct 232 ms 587548 KB Output is correct
10 Correct 237 ms 587600 KB Output is correct
11 Correct 198 ms 589652 KB Output is correct
12 Correct 159 ms 589380 KB Output is correct
13 Correct 139 ms 589508 KB Output is correct
14 Correct 177 ms 589392 KB Output is correct
15 Correct 224 ms 587672 KB Output is correct
16 Correct 189 ms 589396 KB Output is correct
17 Correct 186 ms 589392 KB Output is correct
18 Correct 137 ms 589384 KB Output is correct
19 Correct 222 ms 589556 KB Output is correct
20 Correct 188 ms 589436 KB Output is correct
21 Correct 190 ms 589596 KB Output is correct
22 Correct 183 ms 589392 KB Output is correct
23 Correct 179 ms 589652 KB Output is correct
24 Correct 140 ms 589460 KB Output is correct
25 Correct 231 ms 589336 KB Output is correct
26 Correct 225 ms 589392 KB Output is correct
27 Correct 227 ms 589392 KB Output is correct
28 Correct 135 ms 589388 KB Output is correct
29 Correct 255 ms 587544 KB Output is correct
30 Correct 241 ms 587700 KB Output is correct
31 Correct 234 ms 587600 KB Output is correct
32 Correct 189 ms 589596 KB Output is correct
33 Correct 221 ms 595088 KB Output is correct
34 Correct 134 ms 589712 KB Output is correct
35 Correct 138 ms 587932 KB Output is correct
36 Correct 156 ms 592980 KB Output is correct
37 Correct 150 ms 592044 KB Output is correct
38 Correct 187 ms 594556 KB Output is correct
39 Correct 177 ms 595028 KB Output is correct
40 Correct 191 ms 595300 KB Output is correct
41 Correct 230 ms 595124 KB Output is correct
42 Correct 217 ms 595148 KB Output is correct
43 Correct 250 ms 595040 KB Output is correct
44 Correct 227 ms 595116 KB Output is correct
45 Correct 225 ms 595140 KB Output is correct
46 Correct 228 ms 595268 KB Output is correct
47 Correct 247 ms 595140 KB Output is correct
48 Correct 220 ms 594940 KB Output is correct
49 Correct 246 ms 594908 KB Output is correct
50 Correct 154 ms 595148 KB Output is correct
51 Correct 177 ms 593480 KB Output is correct
52 Correct 189 ms 593488 KB Output is correct
53 Correct 219 ms 593488 KB Output is correct
54 Correct 215 ms 594496 KB Output is correct
55 Correct 208 ms 603576 KB Output is correct
56 Correct 159 ms 595088 KB Output is correct
57 Correct 280 ms 600764 KB Output is correct
58 Correct 274 ms 602328 KB Output is correct
59 Correct 308 ms 603776 KB Output is correct
60 Correct 293 ms 602980 KB Output is correct
61 Correct 291 ms 603724 KB Output is correct
62 Correct 310 ms 603756 KB Output is correct
63 Correct 260 ms 602192 KB Output is correct
64 Correct 271 ms 603856 KB Output is correct
65 Correct 275 ms 603668 KB Output is correct
66 Correct 270 ms 603944 KB Output is correct
67 Correct 341 ms 603756 KB Output is correct
68 Correct 260 ms 603216 KB Output is correct
69 Correct 275 ms 603604 KB Output is correct
70 Correct 270 ms 603752 KB Output is correct
71 Correct 278 ms 603524 KB Output is correct
72 Correct 356 ms 603736 KB Output is correct
73 Correct 293 ms 603796 KB Output is correct
74 Correct 300 ms 603528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 213 ms 589396 KB Output is correct
2 Correct 139 ms 589528 KB Output is correct
3 Correct 139 ms 589392 KB Output is correct
4 Correct 133 ms 589584 KB Output is correct
5 Correct 140 ms 589400 KB Output is correct
6 Correct 137 ms 589388 KB Output is correct
7 Correct 136 ms 589480 KB Output is correct
8 Correct 143 ms 589756 KB Output is correct
9 Correct 132 ms 589252 KB Output is correct
10 Correct 134 ms 589392 KB Output is correct
11 Correct 137 ms 589396 KB Output is correct
12 Correct 132 ms 589320 KB Output is correct
13 Correct 137 ms 589396 KB Output is correct
14 Correct 133 ms 589396 KB Output is correct
15 Correct 136 ms 589392 KB Output is correct
16 Correct 137 ms 589588 KB Output is correct
17 Correct 140 ms 589780 KB Output is correct
18 Correct 137 ms 589396 KB Output is correct
19 Correct 163 ms 595084 KB Output is correct
20 Correct 151 ms 593748 KB Output is correct
21 Correct 157 ms 595024 KB Output is correct
22 Correct 162 ms 595140 KB Output is correct
23 Correct 155 ms 595028 KB Output is correct
24 Correct 152 ms 595100 KB Output is correct
25 Correct 151 ms 595148 KB Output is correct
26 Correct 165 ms 594896 KB Output is correct
27 Correct 170 ms 595324 KB Output is correct
28 Correct 159 ms 595012 KB Output is correct
29 Correct 218 ms 603476 KB Output is correct
30 Correct 165 ms 595268 KB Output is correct
31 Correct 196 ms 603472 KB Output is correct
32 Correct 210 ms 603476 KB Output is correct
33 Correct 205 ms 603532 KB Output is correct
34 Correct 187 ms 603732 KB Output is correct
35 Correct 186 ms 603472 KB Output is correct
36 Correct 216 ms 603472 KB Output is correct
37 Correct 215 ms 603728 KB Output is correct
38 Correct 202 ms 603544 KB Output is correct
39 Correct 1060 ms 740108 KB Output is correct
40 Correct 221 ms 605664 KB Output is correct
41 Correct 197 ms 606800 KB Output is correct
42 Correct 242 ms 609628 KB Output is correct
43 Correct 244 ms 612176 KB Output is correct
44 Correct 618 ms 662912 KB Output is correct
45 Correct 604 ms 669012 KB Output is correct
46 Correct 962 ms 741964 KB Output is correct
47 Correct 1047 ms 740124 KB Output is correct
48 Correct 1102 ms 740136 KB Output is correct
49 Correct 762 ms 740180 KB Output is correct
50 Correct 842 ms 740184 KB Output is correct
51 Correct 1354 ms 740388 KB Output is correct
52 Correct 1411 ms 741384 KB Output is correct
53 Correct 1365 ms 740140 KB Output is correct
54 Correct 188 ms 589492 KB Output is correct
55 Correct 136 ms 589420 KB Output is correct
56 Correct 158 ms 587344 KB Output is correct
57 Correct 221 ms 589496 KB Output is correct
58 Correct 197 ms 589596 KB Output is correct
59 Correct 135 ms 589392 KB Output is correct
60 Correct 173 ms 589500 KB Output is correct
61 Correct 240 ms 587564 KB Output is correct
62 Correct 232 ms 587548 KB Output is correct
63 Correct 237 ms 587600 KB Output is correct
64 Correct 198 ms 589652 KB Output is correct
65 Correct 159 ms 589380 KB Output is correct
66 Correct 139 ms 589508 KB Output is correct
67 Correct 177 ms 589392 KB Output is correct
68 Correct 224 ms 587672 KB Output is correct
69 Correct 189 ms 589396 KB Output is correct
70 Correct 186 ms 589392 KB Output is correct
71 Correct 137 ms 589384 KB Output is correct
72 Correct 222 ms 589556 KB Output is correct
73 Correct 188 ms 589436 KB Output is correct
74 Correct 190 ms 589596 KB Output is correct
75 Correct 183 ms 589392 KB Output is correct
76 Correct 179 ms 589652 KB Output is correct
77 Correct 140 ms 589460 KB Output is correct
78 Correct 231 ms 589336 KB Output is correct
79 Correct 225 ms 589392 KB Output is correct
80 Correct 227 ms 589392 KB Output is correct
81 Correct 135 ms 589388 KB Output is correct
82 Correct 255 ms 587544 KB Output is correct
83 Correct 241 ms 587700 KB Output is correct
84 Correct 234 ms 587600 KB Output is correct
85 Correct 189 ms 589596 KB Output is correct
86 Correct 191 ms 589468 KB Output is correct
87 Correct 136 ms 589380 KB Output is correct
88 Correct 246 ms 587344 KB Output is correct
89 Correct 234 ms 587388 KB Output is correct
90 Correct 228 ms 589400 KB Output is correct
91 Correct 217 ms 589396 KB Output is correct
92 Correct 217 ms 589592 KB Output is correct
93 Correct 216 ms 589380 KB Output is correct
94 Correct 198 ms 589396 KB Output is correct
95 Correct 182 ms 589392 KB Output is correct
96 Correct 182 ms 589648 KB Output is correct
97 Correct 182 ms 589392 KB Output is correct
98 Correct 145 ms 589444 KB Output is correct
99 Correct 204 ms 589488 KB Output is correct
100 Correct 197 ms 589396 KB Output is correct
101 Correct 201 ms 589560 KB Output is correct
102 Correct 198 ms 589456 KB Output is correct
103 Correct 139 ms 589360 KB Output is correct
104 Correct 148 ms 587568 KB Output is correct
105 Correct 183 ms 589388 KB Output is correct
106 Correct 199 ms 589500 KB Output is correct
107 Correct 200 ms 589384 KB Output is correct
108 Correct 198 ms 589580 KB Output is correct
109 Correct 200 ms 589720 KB Output is correct
110 Correct 212 ms 592980 KB Output is correct
111 Correct 220 ms 594496 KB Output is correct
112 Correct 226 ms 595024 KB Output is correct
113 Correct 214 ms 595028 KB Output is correct
114 Correct 220 ms 595028 KB Output is correct
115 Correct 234 ms 595028 KB Output is correct
116 Correct 183 ms 594908 KB Output is correct
117 Correct 208 ms 595076 KB Output is correct
118 Correct 220 ms 595124 KB Output is correct
119 Correct 248 ms 600756 KB Output is correct
120 Correct 275 ms 603632 KB Output is correct
121 Correct 197 ms 602816 KB Output is correct
122 Correct 192 ms 603728 KB Output is correct
123 Correct 182 ms 603512 KB Output is correct
124 Correct 447 ms 633548 KB Output is correct
125 Correct 1072 ms 717128 KB Output is correct
126 Correct 1063 ms 740560 KB Output is correct
127 Correct 979 ms 742032 KB Output is correct
128 Correct 718 ms 735236 KB Output is correct
129 Correct 704 ms 735128 KB Output is correct
130 Correct 1232 ms 740472 KB Output is correct
131 Correct 1251 ms 740700 KB Output is correct
132 Correct 221 ms 595088 KB Output is correct
133 Correct 134 ms 589712 KB Output is correct
134 Correct 138 ms 587932 KB Output is correct
135 Correct 156 ms 592980 KB Output is correct
136 Correct 150 ms 592044 KB Output is correct
137 Correct 187 ms 594556 KB Output is correct
138 Correct 177 ms 595028 KB Output is correct
139 Correct 191 ms 595300 KB Output is correct
140 Correct 230 ms 595124 KB Output is correct
141 Correct 217 ms 595148 KB Output is correct
142 Correct 250 ms 595040 KB Output is correct
143 Correct 227 ms 595116 KB Output is correct
144 Correct 225 ms 595140 KB Output is correct
145 Correct 228 ms 595268 KB Output is correct
146 Correct 247 ms 595140 KB Output is correct
147 Correct 220 ms 594940 KB Output is correct
148 Correct 246 ms 594908 KB Output is correct
149 Correct 154 ms 595148 KB Output is correct
150 Correct 177 ms 593480 KB Output is correct
151 Correct 189 ms 593488 KB Output is correct
152 Correct 219 ms 593488 KB Output is correct
153 Correct 215 ms 594496 KB Output is correct
154 Correct 208 ms 603576 KB Output is correct
155 Correct 159 ms 595088 KB Output is correct
156 Correct 280 ms 600764 KB Output is correct
157 Correct 274 ms 602328 KB Output is correct
158 Correct 308 ms 603776 KB Output is correct
159 Correct 293 ms 602980 KB Output is correct
160 Correct 291 ms 603724 KB Output is correct
161 Correct 310 ms 603756 KB Output is correct
162 Correct 260 ms 602192 KB Output is correct
163 Correct 271 ms 603856 KB Output is correct
164 Correct 275 ms 603668 KB Output is correct
165 Correct 270 ms 603944 KB Output is correct
166 Correct 341 ms 603756 KB Output is correct
167 Correct 260 ms 603216 KB Output is correct
168 Correct 275 ms 603604 KB Output is correct
169 Correct 270 ms 603752 KB Output is correct
170 Correct 278 ms 603524 KB Output is correct
171 Correct 356 ms 603736 KB Output is correct
172 Correct 293 ms 603796 KB Output is correct
173 Correct 300 ms 603528 KB Output is correct
174 Correct 351 ms 608132 KB Output is correct
175 Correct 319 ms 621872 KB Output is correct
176 Correct 518 ms 665724 KB Output is correct
177 Correct 749 ms 690624 KB Output is correct
178 Correct 1163 ms 721912 KB Output is correct
179 Correct 1035 ms 742896 KB Output is correct
180 Correct 1189 ms 741796 KB Output is correct
181 Correct 1354 ms 741548 KB Output is correct
182 Correct 1352 ms 741752 KB Output is correct
183 Correct 1189 ms 743188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 213 ms 589396 KB Output is correct
2 Correct 139 ms 589528 KB Output is correct
3 Correct 139 ms 589392 KB Output is correct
4 Correct 133 ms 589584 KB Output is correct
5 Correct 140 ms 589400 KB Output is correct
6 Correct 137 ms 589388 KB Output is correct
7 Correct 136 ms 589480 KB Output is correct
8 Correct 143 ms 589756 KB Output is correct
9 Correct 132 ms 589252 KB Output is correct
10 Correct 134 ms 589392 KB Output is correct
11 Correct 137 ms 589396 KB Output is correct
12 Correct 132 ms 589320 KB Output is correct
13 Correct 137 ms 589396 KB Output is correct
14 Correct 133 ms 589396 KB Output is correct
15 Correct 136 ms 589392 KB Output is correct
16 Correct 137 ms 589588 KB Output is correct
17 Correct 140 ms 589780 KB Output is correct
18 Correct 137 ms 589396 KB Output is correct
19 Correct 163 ms 595084 KB Output is correct
20 Correct 151 ms 593748 KB Output is correct
21 Correct 157 ms 595024 KB Output is correct
22 Correct 162 ms 595140 KB Output is correct
23 Correct 155 ms 595028 KB Output is correct
24 Correct 152 ms 595100 KB Output is correct
25 Correct 151 ms 595148 KB Output is correct
26 Correct 165 ms 594896 KB Output is correct
27 Correct 170 ms 595324 KB Output is correct
28 Correct 159 ms 595012 KB Output is correct
29 Correct 218 ms 603476 KB Output is correct
30 Correct 165 ms 595268 KB Output is correct
31 Correct 196 ms 603472 KB Output is correct
32 Correct 210 ms 603476 KB Output is correct
33 Correct 205 ms 603532 KB Output is correct
34 Correct 187 ms 603732 KB Output is correct
35 Correct 186 ms 603472 KB Output is correct
36 Correct 216 ms 603472 KB Output is correct
37 Correct 215 ms 603728 KB Output is correct
38 Correct 202 ms 603544 KB Output is correct
39 Correct 1060 ms 740108 KB Output is correct
40 Correct 221 ms 605664 KB Output is correct
41 Correct 197 ms 606800 KB Output is correct
42 Correct 242 ms 609628 KB Output is correct
43 Correct 244 ms 612176 KB Output is correct
44 Correct 618 ms 662912 KB Output is correct
45 Correct 604 ms 669012 KB Output is correct
46 Correct 962 ms 741964 KB Output is correct
47 Correct 1047 ms 740124 KB Output is correct
48 Correct 1102 ms 740136 KB Output is correct
49 Correct 762 ms 740180 KB Output is correct
50 Correct 842 ms 740184 KB Output is correct
51 Correct 1354 ms 740388 KB Output is correct
52 Correct 1411 ms 741384 KB Output is correct
53 Correct 1365 ms 740140 KB Output is correct
54 Correct 188 ms 589492 KB Output is correct
55 Correct 136 ms 589420 KB Output is correct
56 Correct 158 ms 587344 KB Output is correct
57 Correct 221 ms 589496 KB Output is correct
58 Correct 197 ms 589596 KB Output is correct
59 Correct 135 ms 589392 KB Output is correct
60 Correct 173 ms 589500 KB Output is correct
61 Correct 240 ms 587564 KB Output is correct
62 Correct 232 ms 587548 KB Output is correct
63 Correct 237 ms 587600 KB Output is correct
64 Correct 198 ms 589652 KB Output is correct
65 Correct 159 ms 589380 KB Output is correct
66 Correct 139 ms 589508 KB Output is correct
67 Correct 177 ms 589392 KB Output is correct
68 Correct 224 ms 587672 KB Output is correct
69 Correct 189 ms 589396 KB Output is correct
70 Correct 186 ms 589392 KB Output is correct
71 Correct 137 ms 589384 KB Output is correct
72 Correct 222 ms 589556 KB Output is correct
73 Correct 188 ms 589436 KB Output is correct
74 Correct 190 ms 589596 KB Output is correct
75 Correct 183 ms 589392 KB Output is correct
76 Correct 179 ms 589652 KB Output is correct
77 Correct 140 ms 589460 KB Output is correct
78 Correct 231 ms 589336 KB Output is correct
79 Correct 225 ms 589392 KB Output is correct
80 Correct 227 ms 589392 KB Output is correct
81 Correct 135 ms 589388 KB Output is correct
82 Correct 255 ms 587544 KB Output is correct
83 Correct 241 ms 587700 KB Output is correct
84 Correct 234 ms 587600 KB Output is correct
85 Correct 189 ms 589596 KB Output is correct
86 Correct 191 ms 589468 KB Output is correct
87 Correct 136 ms 589380 KB Output is correct
88 Correct 246 ms 587344 KB Output is correct
89 Correct 234 ms 587388 KB Output is correct
90 Correct 228 ms 589400 KB Output is correct
91 Correct 217 ms 589396 KB Output is correct
92 Correct 217 ms 589592 KB Output is correct
93 Correct 216 ms 589380 KB Output is correct
94 Correct 198 ms 589396 KB Output is correct
95 Correct 182 ms 589392 KB Output is correct
96 Correct 182 ms 589648 KB Output is correct
97 Correct 182 ms 589392 KB Output is correct
98 Correct 145 ms 589444 KB Output is correct
99 Correct 204 ms 589488 KB Output is correct
100 Correct 197 ms 589396 KB Output is correct
101 Correct 201 ms 589560 KB Output is correct
102 Correct 198 ms 589456 KB Output is correct
103 Correct 139 ms 589360 KB Output is correct
104 Correct 148 ms 587568 KB Output is correct
105 Correct 183 ms 589388 KB Output is correct
106 Correct 199 ms 589500 KB Output is correct
107 Correct 200 ms 589384 KB Output is correct
108 Correct 198 ms 589580 KB Output is correct
109 Correct 200 ms 589720 KB Output is correct
110 Correct 212 ms 592980 KB Output is correct
111 Correct 220 ms 594496 KB Output is correct
112 Correct 226 ms 595024 KB Output is correct
113 Correct 214 ms 595028 KB Output is correct
114 Correct 220 ms 595028 KB Output is correct
115 Correct 234 ms 595028 KB Output is correct
116 Correct 183 ms 594908 KB Output is correct
117 Correct 208 ms 595076 KB Output is correct
118 Correct 220 ms 595124 KB Output is correct
119 Correct 248 ms 600756 KB Output is correct
120 Correct 275 ms 603632 KB Output is correct
121 Correct 197 ms 602816 KB Output is correct
122 Correct 192 ms 603728 KB Output is correct
123 Correct 182 ms 603512 KB Output is correct
124 Correct 447 ms 633548 KB Output is correct
125 Correct 1072 ms 717128 KB Output is correct
126 Correct 1063 ms 740560 KB Output is correct
127 Correct 979 ms 742032 KB Output is correct
128 Correct 718 ms 735236 KB Output is correct
129 Correct 704 ms 735128 KB Output is correct
130 Correct 1232 ms 740472 KB Output is correct
131 Correct 1251 ms 740700 KB Output is correct
132 Correct 221 ms 595088 KB Output is correct
133 Correct 134 ms 589712 KB Output is correct
134 Correct 138 ms 587932 KB Output is correct
135 Correct 156 ms 592980 KB Output is correct
136 Correct 150 ms 592044 KB Output is correct
137 Correct 187 ms 594556 KB Output is correct
138 Correct 177 ms 595028 KB Output is correct
139 Correct 191 ms 595300 KB Output is correct
140 Correct 230 ms 595124 KB Output is correct
141 Correct 217 ms 595148 KB Output is correct
142 Correct 250 ms 595040 KB Output is correct
143 Correct 227 ms 595116 KB Output is correct
144 Correct 225 ms 595140 KB Output is correct
145 Correct 228 ms 595268 KB Output is correct
146 Correct 247 ms 595140 KB Output is correct
147 Correct 220 ms 594940 KB Output is correct
148 Correct 246 ms 594908 KB Output is correct
149 Correct 154 ms 595148 KB Output is correct
150 Correct 177 ms 593480 KB Output is correct
151 Correct 189 ms 593488 KB Output is correct
152 Correct 219 ms 593488 KB Output is correct
153 Correct 215 ms 594496 KB Output is correct
154 Correct 208 ms 603576 KB Output is correct
155 Correct 159 ms 595088 KB Output is correct
156 Correct 280 ms 600764 KB Output is correct
157 Correct 274 ms 602328 KB Output is correct
158 Correct 308 ms 603776 KB Output is correct
159 Correct 293 ms 602980 KB Output is correct
160 Correct 291 ms 603724 KB Output is correct
161 Correct 310 ms 603756 KB Output is correct
162 Correct 260 ms 602192 KB Output is correct
163 Correct 271 ms 603856 KB Output is correct
164 Correct 275 ms 603668 KB Output is correct
165 Correct 270 ms 603944 KB Output is correct
166 Correct 341 ms 603756 KB Output is correct
167 Correct 260 ms 603216 KB Output is correct
168 Correct 275 ms 603604 KB Output is correct
169 Correct 270 ms 603752 KB Output is correct
170 Correct 278 ms 603524 KB Output is correct
171 Correct 356 ms 603736 KB Output is correct
172 Correct 293 ms 603796 KB Output is correct
173 Correct 300 ms 603528 KB Output is correct
174 Correct 351 ms 608132 KB Output is correct
175 Correct 319 ms 621872 KB Output is correct
176 Correct 518 ms 665724 KB Output is correct
177 Correct 749 ms 690624 KB Output is correct
178 Correct 1163 ms 721912 KB Output is correct
179 Correct 1035 ms 742896 KB Output is correct
180 Correct 1189 ms 741796 KB Output is correct
181 Correct 1354 ms 741548 KB Output is correct
182 Correct 1352 ms 741752 KB Output is correct
183 Correct 1189 ms 743188 KB Output is correct
184 Execution timed out 2096 ms 895660 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 213 ms 589396 KB Output is correct
2 Correct 139 ms 589528 KB Output is correct
3 Correct 139 ms 589392 KB Output is correct
4 Correct 133 ms 589584 KB Output is correct
5 Correct 140 ms 589400 KB Output is correct
6 Correct 137 ms 589388 KB Output is correct
7 Correct 136 ms 589480 KB Output is correct
8 Correct 143 ms 589756 KB Output is correct
9 Correct 132 ms 589252 KB Output is correct
10 Correct 134 ms 589392 KB Output is correct
11 Correct 137 ms 589396 KB Output is correct
12 Correct 132 ms 589320 KB Output is correct
13 Correct 137 ms 589396 KB Output is correct
14 Correct 133 ms 589396 KB Output is correct
15 Correct 136 ms 589392 KB Output is correct
16 Correct 137 ms 589588 KB Output is correct
17 Correct 140 ms 589780 KB Output is correct
18 Correct 137 ms 589396 KB Output is correct
19 Correct 163 ms 595084 KB Output is correct
20 Correct 151 ms 593748 KB Output is correct
21 Correct 157 ms 595024 KB Output is correct
22 Correct 162 ms 595140 KB Output is correct
23 Correct 155 ms 595028 KB Output is correct
24 Correct 152 ms 595100 KB Output is correct
25 Correct 151 ms 595148 KB Output is correct
26 Correct 165 ms 594896 KB Output is correct
27 Correct 170 ms 595324 KB Output is correct
28 Correct 159 ms 595012 KB Output is correct
29 Correct 218 ms 603476 KB Output is correct
30 Correct 165 ms 595268 KB Output is correct
31 Correct 196 ms 603472 KB Output is correct
32 Correct 210 ms 603476 KB Output is correct
33 Correct 205 ms 603532 KB Output is correct
34 Correct 187 ms 603732 KB Output is correct
35 Correct 186 ms 603472 KB Output is correct
36 Correct 216 ms 603472 KB Output is correct
37 Correct 215 ms 603728 KB Output is correct
38 Correct 202 ms 603544 KB Output is correct
39 Correct 1060 ms 740108 KB Output is correct
40 Correct 221 ms 605664 KB Output is correct
41 Correct 197 ms 606800 KB Output is correct
42 Correct 242 ms 609628 KB Output is correct
43 Correct 244 ms 612176 KB Output is correct
44 Correct 618 ms 662912 KB Output is correct
45 Correct 604 ms 669012 KB Output is correct
46 Correct 962 ms 741964 KB Output is correct
47 Correct 1047 ms 740124 KB Output is correct
48 Correct 1102 ms 740136 KB Output is correct
49 Correct 762 ms 740180 KB Output is correct
50 Correct 842 ms 740184 KB Output is correct
51 Correct 1354 ms 740388 KB Output is correct
52 Correct 1411 ms 741384 KB Output is correct
53 Correct 1365 ms 740140 KB Output is correct
54 Correct 188 ms 589492 KB Output is correct
55 Correct 136 ms 589420 KB Output is correct
56 Correct 158 ms 587344 KB Output is correct
57 Correct 221 ms 589496 KB Output is correct
58 Correct 197 ms 589596 KB Output is correct
59 Correct 135 ms 589392 KB Output is correct
60 Correct 173 ms 589500 KB Output is correct
61 Correct 240 ms 587564 KB Output is correct
62 Correct 232 ms 587548 KB Output is correct
63 Correct 237 ms 587600 KB Output is correct
64 Correct 198 ms 589652 KB Output is correct
65 Correct 159 ms 589380 KB Output is correct
66 Correct 139 ms 589508 KB Output is correct
67 Correct 177 ms 589392 KB Output is correct
68 Correct 224 ms 587672 KB Output is correct
69 Correct 189 ms 589396 KB Output is correct
70 Correct 186 ms 589392 KB Output is correct
71 Correct 137 ms 589384 KB Output is correct
72 Correct 222 ms 589556 KB Output is correct
73 Correct 188 ms 589436 KB Output is correct
74 Correct 190 ms 589596 KB Output is correct
75 Correct 183 ms 589392 KB Output is correct
76 Correct 179 ms 589652 KB Output is correct
77 Correct 140 ms 589460 KB Output is correct
78 Correct 231 ms 589336 KB Output is correct
79 Correct 225 ms 589392 KB Output is correct
80 Correct 227 ms 589392 KB Output is correct
81 Correct 135 ms 589388 KB Output is correct
82 Correct 255 ms 587544 KB Output is correct
83 Correct 241 ms 587700 KB Output is correct
84 Correct 234 ms 587600 KB Output is correct
85 Correct 189 ms 589596 KB Output is correct
86 Correct 191 ms 589468 KB Output is correct
87 Correct 136 ms 589380 KB Output is correct
88 Correct 246 ms 587344 KB Output is correct
89 Correct 234 ms 587388 KB Output is correct
90 Correct 228 ms 589400 KB Output is correct
91 Correct 217 ms 589396 KB Output is correct
92 Correct 217 ms 589592 KB Output is correct
93 Correct 216 ms 589380 KB Output is correct
94 Correct 198 ms 589396 KB Output is correct
95 Correct 182 ms 589392 KB Output is correct
96 Correct 182 ms 589648 KB Output is correct
97 Correct 182 ms 589392 KB Output is correct
98 Correct 145 ms 589444 KB Output is correct
99 Correct 204 ms 589488 KB Output is correct
100 Correct 197 ms 589396 KB Output is correct
101 Correct 201 ms 589560 KB Output is correct
102 Correct 198 ms 589456 KB Output is correct
103 Correct 139 ms 589360 KB Output is correct
104 Correct 148 ms 587568 KB Output is correct
105 Correct 183 ms 589388 KB Output is correct
106 Correct 199 ms 589500 KB Output is correct
107 Correct 200 ms 589384 KB Output is correct
108 Correct 198 ms 589580 KB Output is correct
109 Correct 200 ms 589720 KB Output is correct
110 Correct 212 ms 592980 KB Output is correct
111 Correct 220 ms 594496 KB Output is correct
112 Correct 226 ms 595024 KB Output is correct
113 Correct 214 ms 595028 KB Output is correct
114 Correct 220 ms 595028 KB Output is correct
115 Correct 234 ms 595028 KB Output is correct
116 Correct 183 ms 594908 KB Output is correct
117 Correct 208 ms 595076 KB Output is correct
118 Correct 220 ms 595124 KB Output is correct
119 Correct 248 ms 600756 KB Output is correct
120 Correct 275 ms 603632 KB Output is correct
121 Correct 197 ms 602816 KB Output is correct
122 Correct 192 ms 603728 KB Output is correct
123 Correct 182 ms 603512 KB Output is correct
124 Correct 447 ms 633548 KB Output is correct
125 Correct 1072 ms 717128 KB Output is correct
126 Correct 1063 ms 740560 KB Output is correct
127 Correct 979 ms 742032 KB Output is correct
128 Correct 718 ms 735236 KB Output is correct
129 Correct 704 ms 735128 KB Output is correct
130 Correct 1232 ms 740472 KB Output is correct
131 Correct 1251 ms 740700 KB Output is correct
132 Correct 221 ms 595088 KB Output is correct
133 Correct 134 ms 589712 KB Output is correct
134 Correct 138 ms 587932 KB Output is correct
135 Correct 156 ms 592980 KB Output is correct
136 Correct 150 ms 592044 KB Output is correct
137 Correct 187 ms 594556 KB Output is correct
138 Correct 177 ms 595028 KB Output is correct
139 Correct 191 ms 595300 KB Output is correct
140 Correct 230 ms 595124 KB Output is correct
141 Correct 217 ms 595148 KB Output is correct
142 Correct 250 ms 595040 KB Output is correct
143 Correct 227 ms 595116 KB Output is correct
144 Correct 225 ms 595140 KB Output is correct
145 Correct 228 ms 595268 KB Output is correct
146 Correct 247 ms 595140 KB Output is correct
147 Correct 220 ms 594940 KB Output is correct
148 Correct 246 ms 594908 KB Output is correct
149 Correct 154 ms 595148 KB Output is correct
150 Correct 177 ms 593480 KB Output is correct
151 Correct 189 ms 593488 KB Output is correct
152 Correct 219 ms 593488 KB Output is correct
153 Correct 215 ms 594496 KB Output is correct
154 Correct 208 ms 603576 KB Output is correct
155 Correct 159 ms 595088 KB Output is correct
156 Correct 280 ms 600764 KB Output is correct
157 Correct 274 ms 602328 KB Output is correct
158 Correct 308 ms 603776 KB Output is correct
159 Correct 293 ms 602980 KB Output is correct
160 Correct 291 ms 603724 KB Output is correct
161 Correct 310 ms 603756 KB Output is correct
162 Correct 260 ms 602192 KB Output is correct
163 Correct 271 ms 603856 KB Output is correct
164 Correct 275 ms 603668 KB Output is correct
165 Correct 270 ms 603944 KB Output is correct
166 Correct 341 ms 603756 KB Output is correct
167 Correct 260 ms 603216 KB Output is correct
168 Correct 275 ms 603604 KB Output is correct
169 Correct 270 ms 603752 KB Output is correct
170 Correct 278 ms 603524 KB Output is correct
171 Correct 356 ms 603736 KB Output is correct
172 Correct 293 ms 603796 KB Output is correct
173 Correct 300 ms 603528 KB Output is correct
174 Correct 351 ms 608132 KB Output is correct
175 Correct 319 ms 621872 KB Output is correct
176 Correct 518 ms 665724 KB Output is correct
177 Correct 749 ms 690624 KB Output is correct
178 Correct 1163 ms 721912 KB Output is correct
179 Correct 1035 ms 742896 KB Output is correct
180 Correct 1189 ms 741796 KB Output is correct
181 Correct 1354 ms 741548 KB Output is correct
182 Correct 1352 ms 741752 KB Output is correct
183 Correct 1189 ms 743188 KB Output is correct
184 Execution timed out 2096 ms 895660 KB Time limit exceeded
185 Halted 0 ms 0 KB -