Submission #924372

# Submission time Handle Problem Language Result Execution time Memory
924372 2024-02-09T02:05:21 Z Edu175 Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 930096 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("O3,unroll-loops")
const ll MAXN=6e6+5;

ll a[MAXN];
ll n,m,k;
ii mem[MAXN];
vector<vector<ll>>mem2;
//inline ll cv(ii x){return m*x.fst+x.snd;}
//inline ii cv(ll x){return {x/m,x%m};}
inline ll cv(ii x){return mem2[x.fst][x.snd];}
inline ii cv(ll x){return mem[x];}
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];
/*struct list{
	vector<ll>L,R;
	ll ini,fin;
	list(ll n):L(n),R(n),ini(n),fin(n+1){
		L.pb(n),L.pb(n);
		R.pb(n+1),R.pb(n+1);
	}
	void push(ll x){ //back
		R[L[fin]]=x;
		L[x]=L[fin];
		R[x]=fin;
		L[fin]=x;
	}
	void erase(x){
		R[L[x]]=R[x];
		
	}
};*/

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);
				return d[e];
			}
			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;
	mem2.resize(n,vector<ll>(m));
	fore(i,0,n)fore(j,0,m){
		mem2[i][j]=m*i+j;
		mem[m*i+j]={i,j};
	}
	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 279 ms 589396 KB Output is correct
2 Correct 204 ms 589288 KB Output is correct
3 Correct 240 ms 589392 KB Output is correct
4 Correct 210 ms 589520 KB Output is correct
5 Correct 263 ms 589604 KB Output is correct
6 Correct 201 ms 589396 KB Output is correct
7 Correct 200 ms 589392 KB Output is correct
8 Correct 203 ms 589476 KB Output is correct
9 Correct 207 ms 589412 KB Output is correct
10 Correct 271 ms 589400 KB Output is correct
11 Correct 207 ms 589648 KB Output is correct
12 Correct 204 ms 589260 KB Output is correct
13 Correct 224 ms 589560 KB Output is correct
14 Correct 205 ms 589748 KB Output is correct
15 Correct 203 ms 589320 KB Output is correct
16 Correct 210 ms 589392 KB Output is correct
17 Correct 200 ms 589584 KB Output is correct
18 Correct 206 ms 589424 KB Output is correct
19 Correct 230 ms 595540 KB Output is correct
20 Correct 234 ms 594072 KB Output is correct
21 Correct 223 ms 595492 KB Output is correct
22 Correct 238 ms 595804 KB Output is correct
23 Correct 225 ms 595816 KB Output is correct
24 Correct 225 ms 595560 KB Output is correct
25 Correct 224 ms 595548 KB Output is correct
26 Correct 223 ms 595452 KB Output is correct
27 Correct 227 ms 595536 KB Output is correct
28 Correct 224 ms 595540 KB Output is correct
29 Correct 271 ms 604756 KB Output is correct
30 Correct 224 ms 595720 KB Output is correct
31 Correct 266 ms 605016 KB Output is correct
32 Correct 280 ms 604756 KB Output is correct
33 Correct 275 ms 604984 KB Output is correct
34 Correct 255 ms 604944 KB Output is correct
35 Correct 256 ms 604772 KB Output is correct
36 Correct 270 ms 604996 KB Output is correct
37 Correct 277 ms 605008 KB Output is correct
38 Correct 255 ms 604756 KB Output is correct
39 Correct 1137 ms 758964 KB Output is correct
40 Correct 250 ms 607204 KB Output is correct
41 Correct 268 ms 608640 KB Output is correct
42 Correct 325 ms 611868 KB Output is correct
43 Correct 291 ms 615288 KB Output is correct
44 Correct 480 ms 671228 KB Output is correct
45 Correct 511 ms 677716 KB Output is correct
46 Correct 1112 ms 759660 KB Output is correct
47 Correct 1101 ms 759216 KB Output is correct
48 Correct 1135 ms 759012 KB Output is correct
49 Correct 923 ms 756808 KB Output is correct
50 Correct 932 ms 757272 KB Output is correct
51 Correct 1180 ms 759060 KB Output is correct
52 Correct 1094 ms 759120 KB Output is correct
53 Correct 1134 ms 758832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 212 ms 589324 KB Output is correct
2 Correct 204 ms 589344 KB Output is correct
3 Correct 209 ms 589392 KB Output is correct
4 Correct 202 ms 589380 KB Output is correct
5 Correct 209 ms 589584 KB Output is correct
6 Correct 199 ms 589476 KB Output is correct
7 Correct 203 ms 589356 KB Output is correct
8 Correct 218 ms 589512 KB Output is correct
9 Correct 204 ms 589368 KB Output is correct
10 Correct 204 ms 589392 KB Output is correct
11 Correct 199 ms 589600 KB Output is correct
12 Correct 224 ms 589392 KB Output is correct
13 Correct 213 ms 589944 KB Output is correct
14 Correct 201 ms 589396 KB Output is correct
15 Correct 201 ms 589416 KB Output is correct
16 Correct 207 ms 589396 KB Output is correct
17 Correct 204 ms 589396 KB Output is correct
18 Correct 222 ms 589496 KB Output is correct
19 Correct 209 ms 589788 KB Output is correct
20 Correct 203 ms 589532 KB Output is correct
21 Correct 201 ms 589460 KB Output is correct
22 Correct 234 ms 589776 KB Output is correct
23 Correct 212 ms 589508 KB Output is correct
24 Correct 264 ms 589400 KB Output is correct
25 Correct 208 ms 589684 KB Output is correct
26 Correct 203 ms 589808 KB Output is correct
27 Correct 203 ms 589396 KB Output is correct
28 Correct 204 ms 589392 KB Output is correct
29 Correct 201 ms 589264 KB Output is correct
30 Correct 221 ms 589600 KB Output is correct
31 Correct 202 ms 589604 KB Output is correct
32 Correct 202 ms 589596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 235 ms 589392 KB Output is correct
2 Correct 201 ms 589392 KB Output is correct
3 Correct 201 ms 589396 KB Output is correct
4 Correct 209 ms 589484 KB Output is correct
5 Correct 226 ms 589396 KB Output is correct
6 Correct 201 ms 589508 KB Output is correct
7 Correct 204 ms 589604 KB Output is correct
8 Correct 202 ms 589396 KB Output is correct
9 Correct 201 ms 589396 KB Output is correct
10 Correct 203 ms 589736 KB Output is correct
11 Correct 203 ms 589396 KB Output is correct
12 Correct 207 ms 589396 KB Output is correct
13 Correct 200 ms 589520 KB Output is correct
14 Correct 201 ms 589580 KB Output is correct
15 Correct 201 ms 589388 KB Output is correct
16 Correct 212 ms 589460 KB Output is correct
17 Correct 200 ms 589520 KB Output is correct
18 Correct 206 ms 589372 KB Output is correct
19 Correct 208 ms 589540 KB Output is correct
20 Correct 201 ms 589392 KB Output is correct
21 Correct 203 ms 589396 KB Output is correct
22 Correct 202 ms 589484 KB Output is correct
23 Correct 204 ms 589396 KB Output is correct
24 Correct 201 ms 589580 KB Output is correct
25 Correct 213 ms 593324 KB Output is correct
26 Correct 221 ms 595028 KB Output is correct
27 Correct 222 ms 595536 KB Output is correct
28 Correct 220 ms 595684 KB Output is correct
29 Correct 220 ms 595616 KB Output is correct
30 Correct 221 ms 595648 KB Output is correct
31 Correct 223 ms 595540 KB Output is correct
32 Correct 223 ms 595536 KB Output is correct
33 Correct 226 ms 595536 KB Output is correct
34 Correct 266 ms 601912 KB Output is correct
35 Correct 257 ms 605012 KB Output is correct
36 Correct 256 ms 605012 KB Output is correct
37 Correct 254 ms 604756 KB Output is correct
38 Correct 259 ms 604948 KB Output is correct
39 Correct 423 ms 637264 KB Output is correct
40 Correct 957 ms 732996 KB Output is correct
41 Correct 1016 ms 759396 KB Output is correct
42 Correct 1004 ms 759664 KB Output is correct
43 Correct 810 ms 754000 KB Output is correct
44 Correct 824 ms 754092 KB Output is correct
45 Correct 1148 ms 759412 KB Output is correct
46 Correct 1157 ms 759352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 212 ms 589324 KB Output is correct
2 Correct 204 ms 589344 KB Output is correct
3 Correct 209 ms 589392 KB Output is correct
4 Correct 202 ms 589380 KB Output is correct
5 Correct 209 ms 589584 KB Output is correct
6 Correct 199 ms 589476 KB Output is correct
7 Correct 203 ms 589356 KB Output is correct
8 Correct 218 ms 589512 KB Output is correct
9 Correct 204 ms 589368 KB Output is correct
10 Correct 204 ms 589392 KB Output is correct
11 Correct 199 ms 589600 KB Output is correct
12 Correct 224 ms 589392 KB Output is correct
13 Correct 213 ms 589944 KB Output is correct
14 Correct 201 ms 589396 KB Output is correct
15 Correct 201 ms 589416 KB Output is correct
16 Correct 207 ms 589396 KB Output is correct
17 Correct 204 ms 589396 KB Output is correct
18 Correct 222 ms 589496 KB Output is correct
19 Correct 209 ms 589788 KB Output is correct
20 Correct 203 ms 589532 KB Output is correct
21 Correct 201 ms 589460 KB Output is correct
22 Correct 234 ms 589776 KB Output is correct
23 Correct 212 ms 589508 KB Output is correct
24 Correct 264 ms 589400 KB Output is correct
25 Correct 208 ms 589684 KB Output is correct
26 Correct 203 ms 589808 KB Output is correct
27 Correct 203 ms 589396 KB Output is correct
28 Correct 204 ms 589392 KB Output is correct
29 Correct 201 ms 589264 KB Output is correct
30 Correct 221 ms 589600 KB Output is correct
31 Correct 202 ms 589604 KB Output is correct
32 Correct 202 ms 589596 KB Output is correct
33 Correct 241 ms 595792 KB Output is correct
34 Correct 201 ms 589696 KB Output is correct
35 Correct 200 ms 589904 KB Output is correct
36 Correct 223 ms 593680 KB Output is correct
37 Correct 224 ms 594076 KB Output is correct
38 Correct 224 ms 595024 KB Output is correct
39 Correct 230 ms 596328 KB Output is correct
40 Correct 229 ms 595660 KB Output is correct
41 Correct 229 ms 595540 KB Output is correct
42 Correct 227 ms 595616 KB Output is correct
43 Correct 218 ms 595652 KB Output is correct
44 Correct 226 ms 595404 KB Output is correct
45 Correct 222 ms 595556 KB Output is correct
46 Correct 218 ms 595556 KB Output is correct
47 Correct 221 ms 595640 KB Output is correct
48 Correct 222 ms 595588 KB Output is correct
49 Correct 222 ms 595516 KB Output is correct
50 Correct 229 ms 595792 KB Output is correct
51 Correct 222 ms 595500 KB Output is correct
52 Correct 224 ms 595484 KB Output is correct
53 Correct 223 ms 596052 KB Output is correct
54 Correct 257 ms 595660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 212 ms 589324 KB Output is correct
2 Correct 204 ms 589344 KB Output is correct
3 Correct 209 ms 589392 KB Output is correct
4 Correct 202 ms 589380 KB Output is correct
5 Correct 209 ms 589584 KB Output is correct
6 Correct 199 ms 589476 KB Output is correct
7 Correct 203 ms 589356 KB Output is correct
8 Correct 218 ms 589512 KB Output is correct
9 Correct 204 ms 589368 KB Output is correct
10 Correct 204 ms 589392 KB Output is correct
11 Correct 199 ms 589600 KB Output is correct
12 Correct 224 ms 589392 KB Output is correct
13 Correct 213 ms 589944 KB Output is correct
14 Correct 201 ms 589396 KB Output is correct
15 Correct 201 ms 589416 KB Output is correct
16 Correct 207 ms 589396 KB Output is correct
17 Correct 204 ms 589396 KB Output is correct
18 Correct 222 ms 589496 KB Output is correct
19 Correct 209 ms 589788 KB Output is correct
20 Correct 203 ms 589532 KB Output is correct
21 Correct 201 ms 589460 KB Output is correct
22 Correct 234 ms 589776 KB Output is correct
23 Correct 212 ms 589508 KB Output is correct
24 Correct 264 ms 589400 KB Output is correct
25 Correct 208 ms 589684 KB Output is correct
26 Correct 203 ms 589808 KB Output is correct
27 Correct 203 ms 589396 KB Output is correct
28 Correct 204 ms 589392 KB Output is correct
29 Correct 201 ms 589264 KB Output is correct
30 Correct 221 ms 589600 KB Output is correct
31 Correct 202 ms 589604 KB Output is correct
32 Correct 202 ms 589596 KB Output is correct
33 Correct 241 ms 595792 KB Output is correct
34 Correct 201 ms 589696 KB Output is correct
35 Correct 200 ms 589904 KB Output is correct
36 Correct 223 ms 593680 KB Output is correct
37 Correct 224 ms 594076 KB Output is correct
38 Correct 224 ms 595024 KB Output is correct
39 Correct 230 ms 596328 KB Output is correct
40 Correct 229 ms 595660 KB Output is correct
41 Correct 229 ms 595540 KB Output is correct
42 Correct 227 ms 595616 KB Output is correct
43 Correct 218 ms 595652 KB Output is correct
44 Correct 226 ms 595404 KB Output is correct
45 Correct 222 ms 595556 KB Output is correct
46 Correct 218 ms 595556 KB Output is correct
47 Correct 221 ms 595640 KB Output is correct
48 Correct 222 ms 595588 KB Output is correct
49 Correct 222 ms 595516 KB Output is correct
50 Correct 229 ms 595792 KB Output is correct
51 Correct 222 ms 595500 KB Output is correct
52 Correct 224 ms 595484 KB Output is correct
53 Correct 223 ms 596052 KB Output is correct
54 Correct 257 ms 595660 KB Output is correct
55 Correct 269 ms 604980 KB Output is correct
56 Correct 221 ms 595792 KB Output is correct
57 Correct 302 ms 601888 KB Output is correct
58 Correct 260 ms 603792 KB Output is correct
59 Correct 257 ms 604876 KB Output is correct
60 Correct 282 ms 604756 KB Output is correct
61 Correct 272 ms 605008 KB Output is correct
62 Correct 273 ms 605012 KB Output is correct
63 Correct 255 ms 605008 KB Output is correct
64 Correct 252 ms 604756 KB Output is correct
65 Correct 255 ms 604932 KB Output is correct
66 Correct 253 ms 604932 KB Output is correct
67 Correct 259 ms 604884 KB Output is correct
68 Correct 268 ms 605004 KB Output is correct
69 Correct 264 ms 604756 KB Output is correct
70 Correct 267 ms 604884 KB Output is correct
71 Correct 263 ms 605028 KB Output is correct
72 Correct 268 ms 604752 KB Output is correct
73 Correct 280 ms 604876 KB Output is correct
74 Correct 255 ms 604752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 279 ms 589396 KB Output is correct
2 Correct 204 ms 589288 KB Output is correct
3 Correct 240 ms 589392 KB Output is correct
4 Correct 210 ms 589520 KB Output is correct
5 Correct 263 ms 589604 KB Output is correct
6 Correct 201 ms 589396 KB Output is correct
7 Correct 200 ms 589392 KB Output is correct
8 Correct 203 ms 589476 KB Output is correct
9 Correct 207 ms 589412 KB Output is correct
10 Correct 271 ms 589400 KB Output is correct
11 Correct 207 ms 589648 KB Output is correct
12 Correct 204 ms 589260 KB Output is correct
13 Correct 224 ms 589560 KB Output is correct
14 Correct 205 ms 589748 KB Output is correct
15 Correct 203 ms 589320 KB Output is correct
16 Correct 210 ms 589392 KB Output is correct
17 Correct 200 ms 589584 KB Output is correct
18 Correct 206 ms 589424 KB Output is correct
19 Correct 230 ms 595540 KB Output is correct
20 Correct 234 ms 594072 KB Output is correct
21 Correct 223 ms 595492 KB Output is correct
22 Correct 238 ms 595804 KB Output is correct
23 Correct 225 ms 595816 KB Output is correct
24 Correct 225 ms 595560 KB Output is correct
25 Correct 224 ms 595548 KB Output is correct
26 Correct 223 ms 595452 KB Output is correct
27 Correct 227 ms 595536 KB Output is correct
28 Correct 224 ms 595540 KB Output is correct
29 Correct 271 ms 604756 KB Output is correct
30 Correct 224 ms 595720 KB Output is correct
31 Correct 266 ms 605016 KB Output is correct
32 Correct 280 ms 604756 KB Output is correct
33 Correct 275 ms 604984 KB Output is correct
34 Correct 255 ms 604944 KB Output is correct
35 Correct 256 ms 604772 KB Output is correct
36 Correct 270 ms 604996 KB Output is correct
37 Correct 277 ms 605008 KB Output is correct
38 Correct 255 ms 604756 KB Output is correct
39 Correct 1137 ms 758964 KB Output is correct
40 Correct 250 ms 607204 KB Output is correct
41 Correct 268 ms 608640 KB Output is correct
42 Correct 325 ms 611868 KB Output is correct
43 Correct 291 ms 615288 KB Output is correct
44 Correct 480 ms 671228 KB Output is correct
45 Correct 511 ms 677716 KB Output is correct
46 Correct 1112 ms 759660 KB Output is correct
47 Correct 1101 ms 759216 KB Output is correct
48 Correct 1135 ms 759012 KB Output is correct
49 Correct 923 ms 756808 KB Output is correct
50 Correct 932 ms 757272 KB Output is correct
51 Correct 1180 ms 759060 KB Output is correct
52 Correct 1094 ms 759120 KB Output is correct
53 Correct 1134 ms 758832 KB Output is correct
54 Correct 212 ms 589324 KB Output is correct
55 Correct 204 ms 589344 KB Output is correct
56 Correct 209 ms 589392 KB Output is correct
57 Correct 202 ms 589380 KB Output is correct
58 Correct 209 ms 589584 KB Output is correct
59 Correct 199 ms 589476 KB Output is correct
60 Correct 203 ms 589356 KB Output is correct
61 Correct 218 ms 589512 KB Output is correct
62 Correct 204 ms 589368 KB Output is correct
63 Correct 204 ms 589392 KB Output is correct
64 Correct 199 ms 589600 KB Output is correct
65 Correct 224 ms 589392 KB Output is correct
66 Correct 213 ms 589944 KB Output is correct
67 Correct 201 ms 589396 KB Output is correct
68 Correct 201 ms 589416 KB Output is correct
69 Correct 207 ms 589396 KB Output is correct
70 Correct 204 ms 589396 KB Output is correct
71 Correct 222 ms 589496 KB Output is correct
72 Correct 209 ms 589788 KB Output is correct
73 Correct 203 ms 589532 KB Output is correct
74 Correct 201 ms 589460 KB Output is correct
75 Correct 234 ms 589776 KB Output is correct
76 Correct 212 ms 589508 KB Output is correct
77 Correct 264 ms 589400 KB Output is correct
78 Correct 208 ms 589684 KB Output is correct
79 Correct 203 ms 589808 KB Output is correct
80 Correct 203 ms 589396 KB Output is correct
81 Correct 204 ms 589392 KB Output is correct
82 Correct 201 ms 589264 KB Output is correct
83 Correct 221 ms 589600 KB Output is correct
84 Correct 202 ms 589604 KB Output is correct
85 Correct 202 ms 589596 KB Output is correct
86 Correct 235 ms 589392 KB Output is correct
87 Correct 201 ms 589392 KB Output is correct
88 Correct 201 ms 589396 KB Output is correct
89 Correct 209 ms 589484 KB Output is correct
90 Correct 226 ms 589396 KB Output is correct
91 Correct 201 ms 589508 KB Output is correct
92 Correct 204 ms 589604 KB Output is correct
93 Correct 202 ms 589396 KB Output is correct
94 Correct 201 ms 589396 KB Output is correct
95 Correct 203 ms 589736 KB Output is correct
96 Correct 203 ms 589396 KB Output is correct
97 Correct 207 ms 589396 KB Output is correct
98 Correct 200 ms 589520 KB Output is correct
99 Correct 201 ms 589580 KB Output is correct
100 Correct 201 ms 589388 KB Output is correct
101 Correct 212 ms 589460 KB Output is correct
102 Correct 200 ms 589520 KB Output is correct
103 Correct 206 ms 589372 KB Output is correct
104 Correct 208 ms 589540 KB Output is correct
105 Correct 201 ms 589392 KB Output is correct
106 Correct 203 ms 589396 KB Output is correct
107 Correct 202 ms 589484 KB Output is correct
108 Correct 204 ms 589396 KB Output is correct
109 Correct 201 ms 589580 KB Output is correct
110 Correct 213 ms 593324 KB Output is correct
111 Correct 221 ms 595028 KB Output is correct
112 Correct 222 ms 595536 KB Output is correct
113 Correct 220 ms 595684 KB Output is correct
114 Correct 220 ms 595616 KB Output is correct
115 Correct 221 ms 595648 KB Output is correct
116 Correct 223 ms 595540 KB Output is correct
117 Correct 223 ms 595536 KB Output is correct
118 Correct 226 ms 595536 KB Output is correct
119 Correct 266 ms 601912 KB Output is correct
120 Correct 257 ms 605012 KB Output is correct
121 Correct 256 ms 605012 KB Output is correct
122 Correct 254 ms 604756 KB Output is correct
123 Correct 259 ms 604948 KB Output is correct
124 Correct 423 ms 637264 KB Output is correct
125 Correct 957 ms 732996 KB Output is correct
126 Correct 1016 ms 759396 KB Output is correct
127 Correct 1004 ms 759664 KB Output is correct
128 Correct 810 ms 754000 KB Output is correct
129 Correct 824 ms 754092 KB Output is correct
130 Correct 1148 ms 759412 KB Output is correct
131 Correct 1157 ms 759352 KB Output is correct
132 Correct 241 ms 595792 KB Output is correct
133 Correct 201 ms 589696 KB Output is correct
134 Correct 200 ms 589904 KB Output is correct
135 Correct 223 ms 593680 KB Output is correct
136 Correct 224 ms 594076 KB Output is correct
137 Correct 224 ms 595024 KB Output is correct
138 Correct 230 ms 596328 KB Output is correct
139 Correct 229 ms 595660 KB Output is correct
140 Correct 229 ms 595540 KB Output is correct
141 Correct 227 ms 595616 KB Output is correct
142 Correct 218 ms 595652 KB Output is correct
143 Correct 226 ms 595404 KB Output is correct
144 Correct 222 ms 595556 KB Output is correct
145 Correct 218 ms 595556 KB Output is correct
146 Correct 221 ms 595640 KB Output is correct
147 Correct 222 ms 595588 KB Output is correct
148 Correct 222 ms 595516 KB Output is correct
149 Correct 229 ms 595792 KB Output is correct
150 Correct 222 ms 595500 KB Output is correct
151 Correct 224 ms 595484 KB Output is correct
152 Correct 223 ms 596052 KB Output is correct
153 Correct 257 ms 595660 KB Output is correct
154 Correct 269 ms 604980 KB Output is correct
155 Correct 221 ms 595792 KB Output is correct
156 Correct 302 ms 601888 KB Output is correct
157 Correct 260 ms 603792 KB Output is correct
158 Correct 257 ms 604876 KB Output is correct
159 Correct 282 ms 604756 KB Output is correct
160 Correct 272 ms 605008 KB Output is correct
161 Correct 273 ms 605012 KB Output is correct
162 Correct 255 ms 605008 KB Output is correct
163 Correct 252 ms 604756 KB Output is correct
164 Correct 255 ms 604932 KB Output is correct
165 Correct 253 ms 604932 KB Output is correct
166 Correct 259 ms 604884 KB Output is correct
167 Correct 268 ms 605004 KB Output is correct
168 Correct 264 ms 604756 KB Output is correct
169 Correct 267 ms 604884 KB Output is correct
170 Correct 263 ms 605028 KB Output is correct
171 Correct 268 ms 604752 KB Output is correct
172 Correct 280 ms 604876 KB Output is correct
173 Correct 255 ms 604752 KB Output is correct
174 Correct 270 ms 610060 KB Output is correct
175 Correct 357 ms 625932 KB Output is correct
176 Correct 464 ms 673424 KB Output is correct
177 Correct 662 ms 701176 KB Output is correct
178 Correct 668 ms 733096 KB Output is correct
179 Correct 831 ms 756864 KB Output is correct
180 Correct 1036 ms 758868 KB Output is correct
181 Correct 1156 ms 759236 KB Output is correct
182 Correct 1233 ms 758992 KB Output is correct
183 Correct 1046 ms 759004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 279 ms 589396 KB Output is correct
2 Correct 204 ms 589288 KB Output is correct
3 Correct 240 ms 589392 KB Output is correct
4 Correct 210 ms 589520 KB Output is correct
5 Correct 263 ms 589604 KB Output is correct
6 Correct 201 ms 589396 KB Output is correct
7 Correct 200 ms 589392 KB Output is correct
8 Correct 203 ms 589476 KB Output is correct
9 Correct 207 ms 589412 KB Output is correct
10 Correct 271 ms 589400 KB Output is correct
11 Correct 207 ms 589648 KB Output is correct
12 Correct 204 ms 589260 KB Output is correct
13 Correct 224 ms 589560 KB Output is correct
14 Correct 205 ms 589748 KB Output is correct
15 Correct 203 ms 589320 KB Output is correct
16 Correct 210 ms 589392 KB Output is correct
17 Correct 200 ms 589584 KB Output is correct
18 Correct 206 ms 589424 KB Output is correct
19 Correct 230 ms 595540 KB Output is correct
20 Correct 234 ms 594072 KB Output is correct
21 Correct 223 ms 595492 KB Output is correct
22 Correct 238 ms 595804 KB Output is correct
23 Correct 225 ms 595816 KB Output is correct
24 Correct 225 ms 595560 KB Output is correct
25 Correct 224 ms 595548 KB Output is correct
26 Correct 223 ms 595452 KB Output is correct
27 Correct 227 ms 595536 KB Output is correct
28 Correct 224 ms 595540 KB Output is correct
29 Correct 271 ms 604756 KB Output is correct
30 Correct 224 ms 595720 KB Output is correct
31 Correct 266 ms 605016 KB Output is correct
32 Correct 280 ms 604756 KB Output is correct
33 Correct 275 ms 604984 KB Output is correct
34 Correct 255 ms 604944 KB Output is correct
35 Correct 256 ms 604772 KB Output is correct
36 Correct 270 ms 604996 KB Output is correct
37 Correct 277 ms 605008 KB Output is correct
38 Correct 255 ms 604756 KB Output is correct
39 Correct 1137 ms 758964 KB Output is correct
40 Correct 250 ms 607204 KB Output is correct
41 Correct 268 ms 608640 KB Output is correct
42 Correct 325 ms 611868 KB Output is correct
43 Correct 291 ms 615288 KB Output is correct
44 Correct 480 ms 671228 KB Output is correct
45 Correct 511 ms 677716 KB Output is correct
46 Correct 1112 ms 759660 KB Output is correct
47 Correct 1101 ms 759216 KB Output is correct
48 Correct 1135 ms 759012 KB Output is correct
49 Correct 923 ms 756808 KB Output is correct
50 Correct 932 ms 757272 KB Output is correct
51 Correct 1180 ms 759060 KB Output is correct
52 Correct 1094 ms 759120 KB Output is correct
53 Correct 1134 ms 758832 KB Output is correct
54 Correct 212 ms 589324 KB Output is correct
55 Correct 204 ms 589344 KB Output is correct
56 Correct 209 ms 589392 KB Output is correct
57 Correct 202 ms 589380 KB Output is correct
58 Correct 209 ms 589584 KB Output is correct
59 Correct 199 ms 589476 KB Output is correct
60 Correct 203 ms 589356 KB Output is correct
61 Correct 218 ms 589512 KB Output is correct
62 Correct 204 ms 589368 KB Output is correct
63 Correct 204 ms 589392 KB Output is correct
64 Correct 199 ms 589600 KB Output is correct
65 Correct 224 ms 589392 KB Output is correct
66 Correct 213 ms 589944 KB Output is correct
67 Correct 201 ms 589396 KB Output is correct
68 Correct 201 ms 589416 KB Output is correct
69 Correct 207 ms 589396 KB Output is correct
70 Correct 204 ms 589396 KB Output is correct
71 Correct 222 ms 589496 KB Output is correct
72 Correct 209 ms 589788 KB Output is correct
73 Correct 203 ms 589532 KB Output is correct
74 Correct 201 ms 589460 KB Output is correct
75 Correct 234 ms 589776 KB Output is correct
76 Correct 212 ms 589508 KB Output is correct
77 Correct 264 ms 589400 KB Output is correct
78 Correct 208 ms 589684 KB Output is correct
79 Correct 203 ms 589808 KB Output is correct
80 Correct 203 ms 589396 KB Output is correct
81 Correct 204 ms 589392 KB Output is correct
82 Correct 201 ms 589264 KB Output is correct
83 Correct 221 ms 589600 KB Output is correct
84 Correct 202 ms 589604 KB Output is correct
85 Correct 202 ms 589596 KB Output is correct
86 Correct 235 ms 589392 KB Output is correct
87 Correct 201 ms 589392 KB Output is correct
88 Correct 201 ms 589396 KB Output is correct
89 Correct 209 ms 589484 KB Output is correct
90 Correct 226 ms 589396 KB Output is correct
91 Correct 201 ms 589508 KB Output is correct
92 Correct 204 ms 589604 KB Output is correct
93 Correct 202 ms 589396 KB Output is correct
94 Correct 201 ms 589396 KB Output is correct
95 Correct 203 ms 589736 KB Output is correct
96 Correct 203 ms 589396 KB Output is correct
97 Correct 207 ms 589396 KB Output is correct
98 Correct 200 ms 589520 KB Output is correct
99 Correct 201 ms 589580 KB Output is correct
100 Correct 201 ms 589388 KB Output is correct
101 Correct 212 ms 589460 KB Output is correct
102 Correct 200 ms 589520 KB Output is correct
103 Correct 206 ms 589372 KB Output is correct
104 Correct 208 ms 589540 KB Output is correct
105 Correct 201 ms 589392 KB Output is correct
106 Correct 203 ms 589396 KB Output is correct
107 Correct 202 ms 589484 KB Output is correct
108 Correct 204 ms 589396 KB Output is correct
109 Correct 201 ms 589580 KB Output is correct
110 Correct 213 ms 593324 KB Output is correct
111 Correct 221 ms 595028 KB Output is correct
112 Correct 222 ms 595536 KB Output is correct
113 Correct 220 ms 595684 KB Output is correct
114 Correct 220 ms 595616 KB Output is correct
115 Correct 221 ms 595648 KB Output is correct
116 Correct 223 ms 595540 KB Output is correct
117 Correct 223 ms 595536 KB Output is correct
118 Correct 226 ms 595536 KB Output is correct
119 Correct 266 ms 601912 KB Output is correct
120 Correct 257 ms 605012 KB Output is correct
121 Correct 256 ms 605012 KB Output is correct
122 Correct 254 ms 604756 KB Output is correct
123 Correct 259 ms 604948 KB Output is correct
124 Correct 423 ms 637264 KB Output is correct
125 Correct 957 ms 732996 KB Output is correct
126 Correct 1016 ms 759396 KB Output is correct
127 Correct 1004 ms 759664 KB Output is correct
128 Correct 810 ms 754000 KB Output is correct
129 Correct 824 ms 754092 KB Output is correct
130 Correct 1148 ms 759412 KB Output is correct
131 Correct 1157 ms 759352 KB Output is correct
132 Correct 241 ms 595792 KB Output is correct
133 Correct 201 ms 589696 KB Output is correct
134 Correct 200 ms 589904 KB Output is correct
135 Correct 223 ms 593680 KB Output is correct
136 Correct 224 ms 594076 KB Output is correct
137 Correct 224 ms 595024 KB Output is correct
138 Correct 230 ms 596328 KB Output is correct
139 Correct 229 ms 595660 KB Output is correct
140 Correct 229 ms 595540 KB Output is correct
141 Correct 227 ms 595616 KB Output is correct
142 Correct 218 ms 595652 KB Output is correct
143 Correct 226 ms 595404 KB Output is correct
144 Correct 222 ms 595556 KB Output is correct
145 Correct 218 ms 595556 KB Output is correct
146 Correct 221 ms 595640 KB Output is correct
147 Correct 222 ms 595588 KB Output is correct
148 Correct 222 ms 595516 KB Output is correct
149 Correct 229 ms 595792 KB Output is correct
150 Correct 222 ms 595500 KB Output is correct
151 Correct 224 ms 595484 KB Output is correct
152 Correct 223 ms 596052 KB Output is correct
153 Correct 257 ms 595660 KB Output is correct
154 Correct 269 ms 604980 KB Output is correct
155 Correct 221 ms 595792 KB Output is correct
156 Correct 302 ms 601888 KB Output is correct
157 Correct 260 ms 603792 KB Output is correct
158 Correct 257 ms 604876 KB Output is correct
159 Correct 282 ms 604756 KB Output is correct
160 Correct 272 ms 605008 KB Output is correct
161 Correct 273 ms 605012 KB Output is correct
162 Correct 255 ms 605008 KB Output is correct
163 Correct 252 ms 604756 KB Output is correct
164 Correct 255 ms 604932 KB Output is correct
165 Correct 253 ms 604932 KB Output is correct
166 Correct 259 ms 604884 KB Output is correct
167 Correct 268 ms 605004 KB Output is correct
168 Correct 264 ms 604756 KB Output is correct
169 Correct 267 ms 604884 KB Output is correct
170 Correct 263 ms 605028 KB Output is correct
171 Correct 268 ms 604752 KB Output is correct
172 Correct 280 ms 604876 KB Output is correct
173 Correct 255 ms 604752 KB Output is correct
174 Correct 270 ms 610060 KB Output is correct
175 Correct 357 ms 625932 KB Output is correct
176 Correct 464 ms 673424 KB Output is correct
177 Correct 662 ms 701176 KB Output is correct
178 Correct 668 ms 733096 KB Output is correct
179 Correct 831 ms 756864 KB Output is correct
180 Correct 1036 ms 758868 KB Output is correct
181 Correct 1156 ms 759236 KB Output is correct
182 Correct 1233 ms 758992 KB Output is correct
183 Correct 1046 ms 759004 KB Output is correct
184 Execution timed out 2053 ms 930096 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 279 ms 589396 KB Output is correct
2 Correct 204 ms 589288 KB Output is correct
3 Correct 240 ms 589392 KB Output is correct
4 Correct 210 ms 589520 KB Output is correct
5 Correct 263 ms 589604 KB Output is correct
6 Correct 201 ms 589396 KB Output is correct
7 Correct 200 ms 589392 KB Output is correct
8 Correct 203 ms 589476 KB Output is correct
9 Correct 207 ms 589412 KB Output is correct
10 Correct 271 ms 589400 KB Output is correct
11 Correct 207 ms 589648 KB Output is correct
12 Correct 204 ms 589260 KB Output is correct
13 Correct 224 ms 589560 KB Output is correct
14 Correct 205 ms 589748 KB Output is correct
15 Correct 203 ms 589320 KB Output is correct
16 Correct 210 ms 589392 KB Output is correct
17 Correct 200 ms 589584 KB Output is correct
18 Correct 206 ms 589424 KB Output is correct
19 Correct 230 ms 595540 KB Output is correct
20 Correct 234 ms 594072 KB Output is correct
21 Correct 223 ms 595492 KB Output is correct
22 Correct 238 ms 595804 KB Output is correct
23 Correct 225 ms 595816 KB Output is correct
24 Correct 225 ms 595560 KB Output is correct
25 Correct 224 ms 595548 KB Output is correct
26 Correct 223 ms 595452 KB Output is correct
27 Correct 227 ms 595536 KB Output is correct
28 Correct 224 ms 595540 KB Output is correct
29 Correct 271 ms 604756 KB Output is correct
30 Correct 224 ms 595720 KB Output is correct
31 Correct 266 ms 605016 KB Output is correct
32 Correct 280 ms 604756 KB Output is correct
33 Correct 275 ms 604984 KB Output is correct
34 Correct 255 ms 604944 KB Output is correct
35 Correct 256 ms 604772 KB Output is correct
36 Correct 270 ms 604996 KB Output is correct
37 Correct 277 ms 605008 KB Output is correct
38 Correct 255 ms 604756 KB Output is correct
39 Correct 1137 ms 758964 KB Output is correct
40 Correct 250 ms 607204 KB Output is correct
41 Correct 268 ms 608640 KB Output is correct
42 Correct 325 ms 611868 KB Output is correct
43 Correct 291 ms 615288 KB Output is correct
44 Correct 480 ms 671228 KB Output is correct
45 Correct 511 ms 677716 KB Output is correct
46 Correct 1112 ms 759660 KB Output is correct
47 Correct 1101 ms 759216 KB Output is correct
48 Correct 1135 ms 759012 KB Output is correct
49 Correct 923 ms 756808 KB Output is correct
50 Correct 932 ms 757272 KB Output is correct
51 Correct 1180 ms 759060 KB Output is correct
52 Correct 1094 ms 759120 KB Output is correct
53 Correct 1134 ms 758832 KB Output is correct
54 Correct 212 ms 589324 KB Output is correct
55 Correct 204 ms 589344 KB Output is correct
56 Correct 209 ms 589392 KB Output is correct
57 Correct 202 ms 589380 KB Output is correct
58 Correct 209 ms 589584 KB Output is correct
59 Correct 199 ms 589476 KB Output is correct
60 Correct 203 ms 589356 KB Output is correct
61 Correct 218 ms 589512 KB Output is correct
62 Correct 204 ms 589368 KB Output is correct
63 Correct 204 ms 589392 KB Output is correct
64 Correct 199 ms 589600 KB Output is correct
65 Correct 224 ms 589392 KB Output is correct
66 Correct 213 ms 589944 KB Output is correct
67 Correct 201 ms 589396 KB Output is correct
68 Correct 201 ms 589416 KB Output is correct
69 Correct 207 ms 589396 KB Output is correct
70 Correct 204 ms 589396 KB Output is correct
71 Correct 222 ms 589496 KB Output is correct
72 Correct 209 ms 589788 KB Output is correct
73 Correct 203 ms 589532 KB Output is correct
74 Correct 201 ms 589460 KB Output is correct
75 Correct 234 ms 589776 KB Output is correct
76 Correct 212 ms 589508 KB Output is correct
77 Correct 264 ms 589400 KB Output is correct
78 Correct 208 ms 589684 KB Output is correct
79 Correct 203 ms 589808 KB Output is correct
80 Correct 203 ms 589396 KB Output is correct
81 Correct 204 ms 589392 KB Output is correct
82 Correct 201 ms 589264 KB Output is correct
83 Correct 221 ms 589600 KB Output is correct
84 Correct 202 ms 589604 KB Output is correct
85 Correct 202 ms 589596 KB Output is correct
86 Correct 235 ms 589392 KB Output is correct
87 Correct 201 ms 589392 KB Output is correct
88 Correct 201 ms 589396 KB Output is correct
89 Correct 209 ms 589484 KB Output is correct
90 Correct 226 ms 589396 KB Output is correct
91 Correct 201 ms 589508 KB Output is correct
92 Correct 204 ms 589604 KB Output is correct
93 Correct 202 ms 589396 KB Output is correct
94 Correct 201 ms 589396 KB Output is correct
95 Correct 203 ms 589736 KB Output is correct
96 Correct 203 ms 589396 KB Output is correct
97 Correct 207 ms 589396 KB Output is correct
98 Correct 200 ms 589520 KB Output is correct
99 Correct 201 ms 589580 KB Output is correct
100 Correct 201 ms 589388 KB Output is correct
101 Correct 212 ms 589460 KB Output is correct
102 Correct 200 ms 589520 KB Output is correct
103 Correct 206 ms 589372 KB Output is correct
104 Correct 208 ms 589540 KB Output is correct
105 Correct 201 ms 589392 KB Output is correct
106 Correct 203 ms 589396 KB Output is correct
107 Correct 202 ms 589484 KB Output is correct
108 Correct 204 ms 589396 KB Output is correct
109 Correct 201 ms 589580 KB Output is correct
110 Correct 213 ms 593324 KB Output is correct
111 Correct 221 ms 595028 KB Output is correct
112 Correct 222 ms 595536 KB Output is correct
113 Correct 220 ms 595684 KB Output is correct
114 Correct 220 ms 595616 KB Output is correct
115 Correct 221 ms 595648 KB Output is correct
116 Correct 223 ms 595540 KB Output is correct
117 Correct 223 ms 595536 KB Output is correct
118 Correct 226 ms 595536 KB Output is correct
119 Correct 266 ms 601912 KB Output is correct
120 Correct 257 ms 605012 KB Output is correct
121 Correct 256 ms 605012 KB Output is correct
122 Correct 254 ms 604756 KB Output is correct
123 Correct 259 ms 604948 KB Output is correct
124 Correct 423 ms 637264 KB Output is correct
125 Correct 957 ms 732996 KB Output is correct
126 Correct 1016 ms 759396 KB Output is correct
127 Correct 1004 ms 759664 KB Output is correct
128 Correct 810 ms 754000 KB Output is correct
129 Correct 824 ms 754092 KB Output is correct
130 Correct 1148 ms 759412 KB Output is correct
131 Correct 1157 ms 759352 KB Output is correct
132 Correct 241 ms 595792 KB Output is correct
133 Correct 201 ms 589696 KB Output is correct
134 Correct 200 ms 589904 KB Output is correct
135 Correct 223 ms 593680 KB Output is correct
136 Correct 224 ms 594076 KB Output is correct
137 Correct 224 ms 595024 KB Output is correct
138 Correct 230 ms 596328 KB Output is correct
139 Correct 229 ms 595660 KB Output is correct
140 Correct 229 ms 595540 KB Output is correct
141 Correct 227 ms 595616 KB Output is correct
142 Correct 218 ms 595652 KB Output is correct
143 Correct 226 ms 595404 KB Output is correct
144 Correct 222 ms 595556 KB Output is correct
145 Correct 218 ms 595556 KB Output is correct
146 Correct 221 ms 595640 KB Output is correct
147 Correct 222 ms 595588 KB Output is correct
148 Correct 222 ms 595516 KB Output is correct
149 Correct 229 ms 595792 KB Output is correct
150 Correct 222 ms 595500 KB Output is correct
151 Correct 224 ms 595484 KB Output is correct
152 Correct 223 ms 596052 KB Output is correct
153 Correct 257 ms 595660 KB Output is correct
154 Correct 269 ms 604980 KB Output is correct
155 Correct 221 ms 595792 KB Output is correct
156 Correct 302 ms 601888 KB Output is correct
157 Correct 260 ms 603792 KB Output is correct
158 Correct 257 ms 604876 KB Output is correct
159 Correct 282 ms 604756 KB Output is correct
160 Correct 272 ms 605008 KB Output is correct
161 Correct 273 ms 605012 KB Output is correct
162 Correct 255 ms 605008 KB Output is correct
163 Correct 252 ms 604756 KB Output is correct
164 Correct 255 ms 604932 KB Output is correct
165 Correct 253 ms 604932 KB Output is correct
166 Correct 259 ms 604884 KB Output is correct
167 Correct 268 ms 605004 KB Output is correct
168 Correct 264 ms 604756 KB Output is correct
169 Correct 267 ms 604884 KB Output is correct
170 Correct 263 ms 605028 KB Output is correct
171 Correct 268 ms 604752 KB Output is correct
172 Correct 280 ms 604876 KB Output is correct
173 Correct 255 ms 604752 KB Output is correct
174 Correct 270 ms 610060 KB Output is correct
175 Correct 357 ms 625932 KB Output is correct
176 Correct 464 ms 673424 KB Output is correct
177 Correct 662 ms 701176 KB Output is correct
178 Correct 668 ms 733096 KB Output is correct
179 Correct 831 ms 756864 KB Output is correct
180 Correct 1036 ms 758868 KB Output is correct
181 Correct 1156 ms 759236 KB Output is correct
182 Correct 1233 ms 758992 KB Output is correct
183 Correct 1046 ms 759004 KB Output is correct
184 Execution timed out 2053 ms 930096 KB Time limit exceeded
185 Halted 0 ms 0 KB -