Submission #924177

# Submission time Handle Problem Language Result Execution time Memory
924177 2024-02-08T15:53:24 Z vjudge1 Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 894472 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;
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 151 ms 589392 KB Output is correct
2 Correct 181 ms 589648 KB Output is correct
3 Correct 197 ms 587440 KB Output is correct
4 Correct 222 ms 587636 KB Output is correct
5 Correct 244 ms 587464 KB Output is correct
6 Correct 256 ms 589424 KB Output is correct
7 Correct 228 ms 589564 KB Output is correct
8 Correct 206 ms 589496 KB Output is correct
9 Correct 180 ms 587348 KB Output is correct
10 Correct 255 ms 589312 KB Output is correct
11 Correct 250 ms 589504 KB Output is correct
12 Correct 222 ms 589424 KB Output is correct
13 Correct 168 ms 587384 KB Output is correct
14 Correct 283 ms 587720 KB Output is correct
15 Correct 266 ms 587440 KB Output is correct
16 Correct 275 ms 587528 KB Output is correct
17 Correct 224 ms 589596 KB Output is correct
18 Correct 189 ms 589392 KB Output is correct
19 Correct 182 ms 593572 KB Output is correct
20 Correct 262 ms 592212 KB Output is correct
21 Correct 253 ms 593744 KB Output is correct
22 Correct 285 ms 595124 KB Output is correct
23 Correct 303 ms 595024 KB Output is correct
24 Correct 279 ms 593556 KB Output is correct
25 Correct 222 ms 595064 KB Output is correct
26 Correct 203 ms 595060 KB Output is correct
27 Correct 194 ms 595028 KB Output is correct
28 Correct 249 ms 593492 KB Output is correct
29 Correct 340 ms 602932 KB Output is correct
30 Correct 268 ms 593748 KB Output is correct
31 Correct 280 ms 603980 KB Output is correct
32 Correct 300 ms 603732 KB Output is correct
33 Correct 340 ms 603028 KB Output is correct
34 Correct 227 ms 602740 KB Output is correct
35 Correct 250 ms 603620 KB Output is correct
36 Correct 291 ms 602704 KB Output is correct
37 Correct 353 ms 603524 KB Output is correct
38 Correct 318 ms 602696 KB Output is correct
39 Correct 1238 ms 741604 KB Output is correct
40 Correct 356 ms 605436 KB Output is correct
41 Correct 288 ms 606804 KB Output is correct
42 Correct 425 ms 609584 KB Output is correct
43 Correct 326 ms 612520 KB Output is correct
44 Correct 654 ms 663852 KB Output is correct
45 Correct 608 ms 669812 KB Output is correct
46 Correct 1110 ms 742096 KB Output is correct
47 Correct 1131 ms 741456 KB Output is correct
48 Correct 1293 ms 741848 KB Output is correct
49 Correct 797 ms 741604 KB Output is correct
50 Correct 754 ms 742844 KB Output is correct
51 Correct 1306 ms 741712 KB Output is correct
52 Correct 1305 ms 741608 KB Output is correct
53 Correct 1417 ms 742992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 589480 KB Output is correct
2 Correct 225 ms 589308 KB Output is correct
3 Correct 210 ms 589432 KB Output is correct
4 Correct 209 ms 589308 KB Output is correct
5 Correct 138 ms 589400 KB Output is correct
6 Correct 296 ms 587436 KB Output is correct
7 Correct 294 ms 587708 KB Output is correct
8 Correct 137 ms 587604 KB Output is correct
9 Correct 283 ms 587596 KB Output is correct
10 Correct 288 ms 587632 KB Output is correct
11 Correct 187 ms 587436 KB Output is correct
12 Correct 289 ms 587640 KB Output is correct
13 Correct 276 ms 587604 KB Output is correct
14 Correct 281 ms 587644 KB Output is correct
15 Correct 215 ms 589652 KB Output is correct
16 Correct 204 ms 589392 KB Output is correct
17 Correct 203 ms 589472 KB Output is correct
18 Correct 216 ms 589728 KB Output is correct
19 Correct 147 ms 589448 KB Output is correct
20 Correct 263 ms 589528 KB Output is correct
21 Correct 286 ms 589624 KB Output is correct
22 Correct 261 ms 589396 KB Output is correct
23 Correct 224 ms 589308 KB Output is correct
24 Correct 214 ms 589508 KB Output is correct
25 Correct 200 ms 589400 KB Output is correct
26 Correct 199 ms 589384 KB Output is correct
27 Correct 205 ms 589516 KB Output is correct
28 Correct 199 ms 589576 KB Output is correct
29 Correct 141 ms 589392 KB Output is correct
30 Correct 139 ms 589596 KB Output is correct
31 Correct 136 ms 589396 KB Output is correct
32 Correct 141 ms 589596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 138 ms 589360 KB Output is correct
2 Correct 136 ms 589472 KB Output is correct
3 Correct 139 ms 589500 KB Output is correct
4 Correct 138 ms 589408 KB Output is correct
5 Correct 137 ms 589392 KB Output is correct
6 Correct 133 ms 589392 KB Output is correct
7 Correct 138 ms 589504 KB Output is correct
8 Correct 137 ms 589396 KB Output is correct
9 Correct 141 ms 589720 KB Output is correct
10 Correct 134 ms 589600 KB Output is correct
11 Correct 136 ms 589384 KB Output is correct
12 Correct 135 ms 589392 KB Output is correct
13 Correct 135 ms 589396 KB Output is correct
14 Correct 135 ms 589332 KB Output is correct
15 Correct 136 ms 589392 KB Output is correct
16 Correct 136 ms 589396 KB Output is correct
17 Correct 141 ms 589392 KB Output is correct
18 Correct 134 ms 589504 KB Output is correct
19 Correct 138 ms 589400 KB Output is correct
20 Correct 143 ms 589280 KB Output is correct
21 Correct 136 ms 589580 KB Output is correct
22 Correct 135 ms 589400 KB Output is correct
23 Correct 137 ms 589536 KB Output is correct
24 Correct 140 ms 589576 KB Output is correct
25 Correct 150 ms 592980 KB Output is correct
26 Correct 156 ms 594512 KB Output is correct
27 Correct 155 ms 595032 KB Output is correct
28 Correct 162 ms 595056 KB Output is correct
29 Correct 152 ms 595032 KB Output is correct
30 Correct 154 ms 595024 KB Output is correct
31 Correct 165 ms 595208 KB Output is correct
32 Correct 166 ms 595092 KB Output is correct
33 Correct 162 ms 595200 KB Output is correct
34 Correct 189 ms 601012 KB Output is correct
35 Correct 199 ms 603728 KB Output is correct
36 Correct 199 ms 603732 KB Output is correct
37 Correct 183 ms 603476 KB Output is correct
38 Correct 185 ms 603728 KB Output is correct
39 Correct 367 ms 632168 KB Output is correct
40 Correct 942 ms 718552 KB Output is correct
41 Correct 953 ms 742208 KB Output is correct
42 Correct 923 ms 742040 KB Output is correct
43 Correct 637 ms 736592 KB Output is correct
44 Correct 660 ms 736592 KB Output is correct
45 Correct 1254 ms 742460 KB Output is correct
46 Correct 1085 ms 743612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 589480 KB Output is correct
2 Correct 225 ms 589308 KB Output is correct
3 Correct 210 ms 589432 KB Output is correct
4 Correct 209 ms 589308 KB Output is correct
5 Correct 138 ms 589400 KB Output is correct
6 Correct 296 ms 587436 KB Output is correct
7 Correct 294 ms 587708 KB Output is correct
8 Correct 137 ms 587604 KB Output is correct
9 Correct 283 ms 587596 KB Output is correct
10 Correct 288 ms 587632 KB Output is correct
11 Correct 187 ms 587436 KB Output is correct
12 Correct 289 ms 587640 KB Output is correct
13 Correct 276 ms 587604 KB Output is correct
14 Correct 281 ms 587644 KB Output is correct
15 Correct 215 ms 589652 KB Output is correct
16 Correct 204 ms 589392 KB Output is correct
17 Correct 203 ms 589472 KB Output is correct
18 Correct 216 ms 589728 KB Output is correct
19 Correct 147 ms 589448 KB Output is correct
20 Correct 263 ms 589528 KB Output is correct
21 Correct 286 ms 589624 KB Output is correct
22 Correct 261 ms 589396 KB Output is correct
23 Correct 224 ms 589308 KB Output is correct
24 Correct 214 ms 589508 KB Output is correct
25 Correct 200 ms 589400 KB Output is correct
26 Correct 199 ms 589384 KB Output is correct
27 Correct 205 ms 589516 KB Output is correct
28 Correct 199 ms 589576 KB Output is correct
29 Correct 141 ms 589392 KB Output is correct
30 Correct 139 ms 589596 KB Output is correct
31 Correct 136 ms 589396 KB Output is correct
32 Correct 141 ms 589596 KB Output is correct
33 Correct 145 ms 595052 KB Output is correct
34 Correct 118 ms 589528 KB Output is correct
35 Correct 115 ms 589904 KB Output is correct
36 Correct 130 ms 593000 KB Output is correct
37 Correct 130 ms 593860 KB Output is correct
38 Correct 138 ms 594516 KB Output is correct
39 Correct 138 ms 595280 KB Output is correct
40 Correct 142 ms 594980 KB Output is correct
41 Correct 136 ms 595028 KB Output is correct
42 Correct 142 ms 595244 KB Output is correct
43 Correct 136 ms 595028 KB Output is correct
44 Correct 134 ms 595032 KB Output is correct
45 Correct 135 ms 595244 KB Output is correct
46 Correct 138 ms 595280 KB Output is correct
47 Correct 135 ms 595024 KB Output is correct
48 Correct 136 ms 595024 KB Output is correct
49 Correct 139 ms 595064 KB Output is correct
50 Correct 137 ms 595124 KB Output is correct
51 Correct 142 ms 595028 KB Output is correct
52 Correct 147 ms 595236 KB Output is correct
53 Correct 145 ms 594992 KB Output is correct
54 Correct 141 ms 595224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 186 ms 589480 KB Output is correct
2 Correct 225 ms 589308 KB Output is correct
3 Correct 210 ms 589432 KB Output is correct
4 Correct 209 ms 589308 KB Output is correct
5 Correct 138 ms 589400 KB Output is correct
6 Correct 296 ms 587436 KB Output is correct
7 Correct 294 ms 587708 KB Output is correct
8 Correct 137 ms 587604 KB Output is correct
9 Correct 283 ms 587596 KB Output is correct
10 Correct 288 ms 587632 KB Output is correct
11 Correct 187 ms 587436 KB Output is correct
12 Correct 289 ms 587640 KB Output is correct
13 Correct 276 ms 587604 KB Output is correct
14 Correct 281 ms 587644 KB Output is correct
15 Correct 215 ms 589652 KB Output is correct
16 Correct 204 ms 589392 KB Output is correct
17 Correct 203 ms 589472 KB Output is correct
18 Correct 216 ms 589728 KB Output is correct
19 Correct 147 ms 589448 KB Output is correct
20 Correct 263 ms 589528 KB Output is correct
21 Correct 286 ms 589624 KB Output is correct
22 Correct 261 ms 589396 KB Output is correct
23 Correct 224 ms 589308 KB Output is correct
24 Correct 214 ms 589508 KB Output is correct
25 Correct 200 ms 589400 KB Output is correct
26 Correct 199 ms 589384 KB Output is correct
27 Correct 205 ms 589516 KB Output is correct
28 Correct 199 ms 589576 KB Output is correct
29 Correct 141 ms 589392 KB Output is correct
30 Correct 139 ms 589596 KB Output is correct
31 Correct 136 ms 589396 KB Output is correct
32 Correct 141 ms 589596 KB Output is correct
33 Correct 145 ms 595052 KB Output is correct
34 Correct 118 ms 589528 KB Output is correct
35 Correct 115 ms 589904 KB Output is correct
36 Correct 130 ms 593000 KB Output is correct
37 Correct 130 ms 593860 KB Output is correct
38 Correct 138 ms 594516 KB Output is correct
39 Correct 138 ms 595280 KB Output is correct
40 Correct 142 ms 594980 KB Output is correct
41 Correct 136 ms 595028 KB Output is correct
42 Correct 142 ms 595244 KB Output is correct
43 Correct 136 ms 595028 KB Output is correct
44 Correct 134 ms 595032 KB Output is correct
45 Correct 135 ms 595244 KB Output is correct
46 Correct 138 ms 595280 KB Output is correct
47 Correct 135 ms 595024 KB Output is correct
48 Correct 136 ms 595024 KB Output is correct
49 Correct 139 ms 595064 KB Output is correct
50 Correct 137 ms 595124 KB Output is correct
51 Correct 142 ms 595028 KB Output is correct
52 Correct 147 ms 595236 KB Output is correct
53 Correct 145 ms 594992 KB Output is correct
54 Correct 141 ms 595224 KB Output is correct
55 Correct 182 ms 603620 KB Output is correct
56 Correct 140 ms 595360 KB Output is correct
57 Correct 169 ms 600912 KB Output is correct
58 Correct 175 ms 602452 KB Output is correct
59 Correct 179 ms 603620 KB Output is correct
60 Correct 195 ms 603728 KB Output is correct
61 Correct 184 ms 603476 KB Output is correct
62 Correct 171 ms 603476 KB Output is correct
63 Correct 166 ms 603460 KB Output is correct
64 Correct 165 ms 603572 KB Output is correct
65 Correct 167 ms 603536 KB Output is correct
66 Correct 167 ms 603700 KB Output is correct
67 Correct 172 ms 603472 KB Output is correct
68 Correct 169 ms 603476 KB Output is correct
69 Correct 174 ms 603472 KB Output is correct
70 Correct 178 ms 603444 KB Output is correct
71 Correct 184 ms 603660 KB Output is correct
72 Correct 195 ms 603728 KB Output is correct
73 Correct 191 ms 603640 KB Output is correct
74 Correct 185 ms 603620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 151 ms 589392 KB Output is correct
2 Correct 181 ms 589648 KB Output is correct
3 Correct 197 ms 587440 KB Output is correct
4 Correct 222 ms 587636 KB Output is correct
5 Correct 244 ms 587464 KB Output is correct
6 Correct 256 ms 589424 KB Output is correct
7 Correct 228 ms 589564 KB Output is correct
8 Correct 206 ms 589496 KB Output is correct
9 Correct 180 ms 587348 KB Output is correct
10 Correct 255 ms 589312 KB Output is correct
11 Correct 250 ms 589504 KB Output is correct
12 Correct 222 ms 589424 KB Output is correct
13 Correct 168 ms 587384 KB Output is correct
14 Correct 283 ms 587720 KB Output is correct
15 Correct 266 ms 587440 KB Output is correct
16 Correct 275 ms 587528 KB Output is correct
17 Correct 224 ms 589596 KB Output is correct
18 Correct 189 ms 589392 KB Output is correct
19 Correct 182 ms 593572 KB Output is correct
20 Correct 262 ms 592212 KB Output is correct
21 Correct 253 ms 593744 KB Output is correct
22 Correct 285 ms 595124 KB Output is correct
23 Correct 303 ms 595024 KB Output is correct
24 Correct 279 ms 593556 KB Output is correct
25 Correct 222 ms 595064 KB Output is correct
26 Correct 203 ms 595060 KB Output is correct
27 Correct 194 ms 595028 KB Output is correct
28 Correct 249 ms 593492 KB Output is correct
29 Correct 340 ms 602932 KB Output is correct
30 Correct 268 ms 593748 KB Output is correct
31 Correct 280 ms 603980 KB Output is correct
32 Correct 300 ms 603732 KB Output is correct
33 Correct 340 ms 603028 KB Output is correct
34 Correct 227 ms 602740 KB Output is correct
35 Correct 250 ms 603620 KB Output is correct
36 Correct 291 ms 602704 KB Output is correct
37 Correct 353 ms 603524 KB Output is correct
38 Correct 318 ms 602696 KB Output is correct
39 Correct 1238 ms 741604 KB Output is correct
40 Correct 356 ms 605436 KB Output is correct
41 Correct 288 ms 606804 KB Output is correct
42 Correct 425 ms 609584 KB Output is correct
43 Correct 326 ms 612520 KB Output is correct
44 Correct 654 ms 663852 KB Output is correct
45 Correct 608 ms 669812 KB Output is correct
46 Correct 1110 ms 742096 KB Output is correct
47 Correct 1131 ms 741456 KB Output is correct
48 Correct 1293 ms 741848 KB Output is correct
49 Correct 797 ms 741604 KB Output is correct
50 Correct 754 ms 742844 KB Output is correct
51 Correct 1306 ms 741712 KB Output is correct
52 Correct 1305 ms 741608 KB Output is correct
53 Correct 1417 ms 742992 KB Output is correct
54 Correct 186 ms 589480 KB Output is correct
55 Correct 225 ms 589308 KB Output is correct
56 Correct 210 ms 589432 KB Output is correct
57 Correct 209 ms 589308 KB Output is correct
58 Correct 138 ms 589400 KB Output is correct
59 Correct 296 ms 587436 KB Output is correct
60 Correct 294 ms 587708 KB Output is correct
61 Correct 137 ms 587604 KB Output is correct
62 Correct 283 ms 587596 KB Output is correct
63 Correct 288 ms 587632 KB Output is correct
64 Correct 187 ms 587436 KB Output is correct
65 Correct 289 ms 587640 KB Output is correct
66 Correct 276 ms 587604 KB Output is correct
67 Correct 281 ms 587644 KB Output is correct
68 Correct 215 ms 589652 KB Output is correct
69 Correct 204 ms 589392 KB Output is correct
70 Correct 203 ms 589472 KB Output is correct
71 Correct 216 ms 589728 KB Output is correct
72 Correct 147 ms 589448 KB Output is correct
73 Correct 263 ms 589528 KB Output is correct
74 Correct 286 ms 589624 KB Output is correct
75 Correct 261 ms 589396 KB Output is correct
76 Correct 224 ms 589308 KB Output is correct
77 Correct 214 ms 589508 KB Output is correct
78 Correct 200 ms 589400 KB Output is correct
79 Correct 199 ms 589384 KB Output is correct
80 Correct 205 ms 589516 KB Output is correct
81 Correct 199 ms 589576 KB Output is correct
82 Correct 141 ms 589392 KB Output is correct
83 Correct 139 ms 589596 KB Output is correct
84 Correct 136 ms 589396 KB Output is correct
85 Correct 141 ms 589596 KB Output is correct
86 Correct 138 ms 589360 KB Output is correct
87 Correct 136 ms 589472 KB Output is correct
88 Correct 139 ms 589500 KB Output is correct
89 Correct 138 ms 589408 KB Output is correct
90 Correct 137 ms 589392 KB Output is correct
91 Correct 133 ms 589392 KB Output is correct
92 Correct 138 ms 589504 KB Output is correct
93 Correct 137 ms 589396 KB Output is correct
94 Correct 141 ms 589720 KB Output is correct
95 Correct 134 ms 589600 KB Output is correct
96 Correct 136 ms 589384 KB Output is correct
97 Correct 135 ms 589392 KB Output is correct
98 Correct 135 ms 589396 KB Output is correct
99 Correct 135 ms 589332 KB Output is correct
100 Correct 136 ms 589392 KB Output is correct
101 Correct 136 ms 589396 KB Output is correct
102 Correct 141 ms 589392 KB Output is correct
103 Correct 134 ms 589504 KB Output is correct
104 Correct 138 ms 589400 KB Output is correct
105 Correct 143 ms 589280 KB Output is correct
106 Correct 136 ms 589580 KB Output is correct
107 Correct 135 ms 589400 KB Output is correct
108 Correct 137 ms 589536 KB Output is correct
109 Correct 140 ms 589576 KB Output is correct
110 Correct 150 ms 592980 KB Output is correct
111 Correct 156 ms 594512 KB Output is correct
112 Correct 155 ms 595032 KB Output is correct
113 Correct 162 ms 595056 KB Output is correct
114 Correct 152 ms 595032 KB Output is correct
115 Correct 154 ms 595024 KB Output is correct
116 Correct 165 ms 595208 KB Output is correct
117 Correct 166 ms 595092 KB Output is correct
118 Correct 162 ms 595200 KB Output is correct
119 Correct 189 ms 601012 KB Output is correct
120 Correct 199 ms 603728 KB Output is correct
121 Correct 199 ms 603732 KB Output is correct
122 Correct 183 ms 603476 KB Output is correct
123 Correct 185 ms 603728 KB Output is correct
124 Correct 367 ms 632168 KB Output is correct
125 Correct 942 ms 718552 KB Output is correct
126 Correct 953 ms 742208 KB Output is correct
127 Correct 923 ms 742040 KB Output is correct
128 Correct 637 ms 736592 KB Output is correct
129 Correct 660 ms 736592 KB Output is correct
130 Correct 1254 ms 742460 KB Output is correct
131 Correct 1085 ms 743612 KB Output is correct
132 Correct 145 ms 595052 KB Output is correct
133 Correct 118 ms 589528 KB Output is correct
134 Correct 115 ms 589904 KB Output is correct
135 Correct 130 ms 593000 KB Output is correct
136 Correct 130 ms 593860 KB Output is correct
137 Correct 138 ms 594516 KB Output is correct
138 Correct 138 ms 595280 KB Output is correct
139 Correct 142 ms 594980 KB Output is correct
140 Correct 136 ms 595028 KB Output is correct
141 Correct 142 ms 595244 KB Output is correct
142 Correct 136 ms 595028 KB Output is correct
143 Correct 134 ms 595032 KB Output is correct
144 Correct 135 ms 595244 KB Output is correct
145 Correct 138 ms 595280 KB Output is correct
146 Correct 135 ms 595024 KB Output is correct
147 Correct 136 ms 595024 KB Output is correct
148 Correct 139 ms 595064 KB Output is correct
149 Correct 137 ms 595124 KB Output is correct
150 Correct 142 ms 595028 KB Output is correct
151 Correct 147 ms 595236 KB Output is correct
152 Correct 145 ms 594992 KB Output is correct
153 Correct 141 ms 595224 KB Output is correct
154 Correct 182 ms 603620 KB Output is correct
155 Correct 140 ms 595360 KB Output is correct
156 Correct 169 ms 600912 KB Output is correct
157 Correct 175 ms 602452 KB Output is correct
158 Correct 179 ms 603620 KB Output is correct
159 Correct 195 ms 603728 KB Output is correct
160 Correct 184 ms 603476 KB Output is correct
161 Correct 171 ms 603476 KB Output is correct
162 Correct 166 ms 603460 KB Output is correct
163 Correct 165 ms 603572 KB Output is correct
164 Correct 167 ms 603536 KB Output is correct
165 Correct 167 ms 603700 KB Output is correct
166 Correct 172 ms 603472 KB Output is correct
167 Correct 169 ms 603476 KB Output is correct
168 Correct 174 ms 603472 KB Output is correct
169 Correct 178 ms 603444 KB Output is correct
170 Correct 184 ms 603660 KB Output is correct
171 Correct 195 ms 603728 KB Output is correct
172 Correct 191 ms 603640 KB Output is correct
173 Correct 185 ms 603620 KB Output is correct
174 Correct 209 ms 607936 KB Output is correct
175 Correct 269 ms 623348 KB Output is correct
176 Correct 474 ms 665168 KB Output is correct
177 Correct 619 ms 690768 KB Output is correct
178 Correct 873 ms 720728 KB Output is correct
179 Correct 846 ms 741428 KB Output is correct
180 Correct 897 ms 741624 KB Output is correct
181 Correct 1132 ms 741648 KB Output is correct
182 Correct 1143 ms 741576 KB Output is correct
183 Correct 995 ms 741712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 151 ms 589392 KB Output is correct
2 Correct 181 ms 589648 KB Output is correct
3 Correct 197 ms 587440 KB Output is correct
4 Correct 222 ms 587636 KB Output is correct
5 Correct 244 ms 587464 KB Output is correct
6 Correct 256 ms 589424 KB Output is correct
7 Correct 228 ms 589564 KB Output is correct
8 Correct 206 ms 589496 KB Output is correct
9 Correct 180 ms 587348 KB Output is correct
10 Correct 255 ms 589312 KB Output is correct
11 Correct 250 ms 589504 KB Output is correct
12 Correct 222 ms 589424 KB Output is correct
13 Correct 168 ms 587384 KB Output is correct
14 Correct 283 ms 587720 KB Output is correct
15 Correct 266 ms 587440 KB Output is correct
16 Correct 275 ms 587528 KB Output is correct
17 Correct 224 ms 589596 KB Output is correct
18 Correct 189 ms 589392 KB Output is correct
19 Correct 182 ms 593572 KB Output is correct
20 Correct 262 ms 592212 KB Output is correct
21 Correct 253 ms 593744 KB Output is correct
22 Correct 285 ms 595124 KB Output is correct
23 Correct 303 ms 595024 KB Output is correct
24 Correct 279 ms 593556 KB Output is correct
25 Correct 222 ms 595064 KB Output is correct
26 Correct 203 ms 595060 KB Output is correct
27 Correct 194 ms 595028 KB Output is correct
28 Correct 249 ms 593492 KB Output is correct
29 Correct 340 ms 602932 KB Output is correct
30 Correct 268 ms 593748 KB Output is correct
31 Correct 280 ms 603980 KB Output is correct
32 Correct 300 ms 603732 KB Output is correct
33 Correct 340 ms 603028 KB Output is correct
34 Correct 227 ms 602740 KB Output is correct
35 Correct 250 ms 603620 KB Output is correct
36 Correct 291 ms 602704 KB Output is correct
37 Correct 353 ms 603524 KB Output is correct
38 Correct 318 ms 602696 KB Output is correct
39 Correct 1238 ms 741604 KB Output is correct
40 Correct 356 ms 605436 KB Output is correct
41 Correct 288 ms 606804 KB Output is correct
42 Correct 425 ms 609584 KB Output is correct
43 Correct 326 ms 612520 KB Output is correct
44 Correct 654 ms 663852 KB Output is correct
45 Correct 608 ms 669812 KB Output is correct
46 Correct 1110 ms 742096 KB Output is correct
47 Correct 1131 ms 741456 KB Output is correct
48 Correct 1293 ms 741848 KB Output is correct
49 Correct 797 ms 741604 KB Output is correct
50 Correct 754 ms 742844 KB Output is correct
51 Correct 1306 ms 741712 KB Output is correct
52 Correct 1305 ms 741608 KB Output is correct
53 Correct 1417 ms 742992 KB Output is correct
54 Correct 186 ms 589480 KB Output is correct
55 Correct 225 ms 589308 KB Output is correct
56 Correct 210 ms 589432 KB Output is correct
57 Correct 209 ms 589308 KB Output is correct
58 Correct 138 ms 589400 KB Output is correct
59 Correct 296 ms 587436 KB Output is correct
60 Correct 294 ms 587708 KB Output is correct
61 Correct 137 ms 587604 KB Output is correct
62 Correct 283 ms 587596 KB Output is correct
63 Correct 288 ms 587632 KB Output is correct
64 Correct 187 ms 587436 KB Output is correct
65 Correct 289 ms 587640 KB Output is correct
66 Correct 276 ms 587604 KB Output is correct
67 Correct 281 ms 587644 KB Output is correct
68 Correct 215 ms 589652 KB Output is correct
69 Correct 204 ms 589392 KB Output is correct
70 Correct 203 ms 589472 KB Output is correct
71 Correct 216 ms 589728 KB Output is correct
72 Correct 147 ms 589448 KB Output is correct
73 Correct 263 ms 589528 KB Output is correct
74 Correct 286 ms 589624 KB Output is correct
75 Correct 261 ms 589396 KB Output is correct
76 Correct 224 ms 589308 KB Output is correct
77 Correct 214 ms 589508 KB Output is correct
78 Correct 200 ms 589400 KB Output is correct
79 Correct 199 ms 589384 KB Output is correct
80 Correct 205 ms 589516 KB Output is correct
81 Correct 199 ms 589576 KB Output is correct
82 Correct 141 ms 589392 KB Output is correct
83 Correct 139 ms 589596 KB Output is correct
84 Correct 136 ms 589396 KB Output is correct
85 Correct 141 ms 589596 KB Output is correct
86 Correct 138 ms 589360 KB Output is correct
87 Correct 136 ms 589472 KB Output is correct
88 Correct 139 ms 589500 KB Output is correct
89 Correct 138 ms 589408 KB Output is correct
90 Correct 137 ms 589392 KB Output is correct
91 Correct 133 ms 589392 KB Output is correct
92 Correct 138 ms 589504 KB Output is correct
93 Correct 137 ms 589396 KB Output is correct
94 Correct 141 ms 589720 KB Output is correct
95 Correct 134 ms 589600 KB Output is correct
96 Correct 136 ms 589384 KB Output is correct
97 Correct 135 ms 589392 KB Output is correct
98 Correct 135 ms 589396 KB Output is correct
99 Correct 135 ms 589332 KB Output is correct
100 Correct 136 ms 589392 KB Output is correct
101 Correct 136 ms 589396 KB Output is correct
102 Correct 141 ms 589392 KB Output is correct
103 Correct 134 ms 589504 KB Output is correct
104 Correct 138 ms 589400 KB Output is correct
105 Correct 143 ms 589280 KB Output is correct
106 Correct 136 ms 589580 KB Output is correct
107 Correct 135 ms 589400 KB Output is correct
108 Correct 137 ms 589536 KB Output is correct
109 Correct 140 ms 589576 KB Output is correct
110 Correct 150 ms 592980 KB Output is correct
111 Correct 156 ms 594512 KB Output is correct
112 Correct 155 ms 595032 KB Output is correct
113 Correct 162 ms 595056 KB Output is correct
114 Correct 152 ms 595032 KB Output is correct
115 Correct 154 ms 595024 KB Output is correct
116 Correct 165 ms 595208 KB Output is correct
117 Correct 166 ms 595092 KB Output is correct
118 Correct 162 ms 595200 KB Output is correct
119 Correct 189 ms 601012 KB Output is correct
120 Correct 199 ms 603728 KB Output is correct
121 Correct 199 ms 603732 KB Output is correct
122 Correct 183 ms 603476 KB Output is correct
123 Correct 185 ms 603728 KB Output is correct
124 Correct 367 ms 632168 KB Output is correct
125 Correct 942 ms 718552 KB Output is correct
126 Correct 953 ms 742208 KB Output is correct
127 Correct 923 ms 742040 KB Output is correct
128 Correct 637 ms 736592 KB Output is correct
129 Correct 660 ms 736592 KB Output is correct
130 Correct 1254 ms 742460 KB Output is correct
131 Correct 1085 ms 743612 KB Output is correct
132 Correct 145 ms 595052 KB Output is correct
133 Correct 118 ms 589528 KB Output is correct
134 Correct 115 ms 589904 KB Output is correct
135 Correct 130 ms 593000 KB Output is correct
136 Correct 130 ms 593860 KB Output is correct
137 Correct 138 ms 594516 KB Output is correct
138 Correct 138 ms 595280 KB Output is correct
139 Correct 142 ms 594980 KB Output is correct
140 Correct 136 ms 595028 KB Output is correct
141 Correct 142 ms 595244 KB Output is correct
142 Correct 136 ms 595028 KB Output is correct
143 Correct 134 ms 595032 KB Output is correct
144 Correct 135 ms 595244 KB Output is correct
145 Correct 138 ms 595280 KB Output is correct
146 Correct 135 ms 595024 KB Output is correct
147 Correct 136 ms 595024 KB Output is correct
148 Correct 139 ms 595064 KB Output is correct
149 Correct 137 ms 595124 KB Output is correct
150 Correct 142 ms 595028 KB Output is correct
151 Correct 147 ms 595236 KB Output is correct
152 Correct 145 ms 594992 KB Output is correct
153 Correct 141 ms 595224 KB Output is correct
154 Correct 182 ms 603620 KB Output is correct
155 Correct 140 ms 595360 KB Output is correct
156 Correct 169 ms 600912 KB Output is correct
157 Correct 175 ms 602452 KB Output is correct
158 Correct 179 ms 603620 KB Output is correct
159 Correct 195 ms 603728 KB Output is correct
160 Correct 184 ms 603476 KB Output is correct
161 Correct 171 ms 603476 KB Output is correct
162 Correct 166 ms 603460 KB Output is correct
163 Correct 165 ms 603572 KB Output is correct
164 Correct 167 ms 603536 KB Output is correct
165 Correct 167 ms 603700 KB Output is correct
166 Correct 172 ms 603472 KB Output is correct
167 Correct 169 ms 603476 KB Output is correct
168 Correct 174 ms 603472 KB Output is correct
169 Correct 178 ms 603444 KB Output is correct
170 Correct 184 ms 603660 KB Output is correct
171 Correct 195 ms 603728 KB Output is correct
172 Correct 191 ms 603640 KB Output is correct
173 Correct 185 ms 603620 KB Output is correct
174 Correct 209 ms 607936 KB Output is correct
175 Correct 269 ms 623348 KB Output is correct
176 Correct 474 ms 665168 KB Output is correct
177 Correct 619 ms 690768 KB Output is correct
178 Correct 873 ms 720728 KB Output is correct
179 Correct 846 ms 741428 KB Output is correct
180 Correct 897 ms 741624 KB Output is correct
181 Correct 1132 ms 741648 KB Output is correct
182 Correct 1143 ms 741576 KB Output is correct
183 Correct 995 ms 741712 KB Output is correct
184 Execution timed out 2093 ms 894472 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 151 ms 589392 KB Output is correct
2 Correct 181 ms 589648 KB Output is correct
3 Correct 197 ms 587440 KB Output is correct
4 Correct 222 ms 587636 KB Output is correct
5 Correct 244 ms 587464 KB Output is correct
6 Correct 256 ms 589424 KB Output is correct
7 Correct 228 ms 589564 KB Output is correct
8 Correct 206 ms 589496 KB Output is correct
9 Correct 180 ms 587348 KB Output is correct
10 Correct 255 ms 589312 KB Output is correct
11 Correct 250 ms 589504 KB Output is correct
12 Correct 222 ms 589424 KB Output is correct
13 Correct 168 ms 587384 KB Output is correct
14 Correct 283 ms 587720 KB Output is correct
15 Correct 266 ms 587440 KB Output is correct
16 Correct 275 ms 587528 KB Output is correct
17 Correct 224 ms 589596 KB Output is correct
18 Correct 189 ms 589392 KB Output is correct
19 Correct 182 ms 593572 KB Output is correct
20 Correct 262 ms 592212 KB Output is correct
21 Correct 253 ms 593744 KB Output is correct
22 Correct 285 ms 595124 KB Output is correct
23 Correct 303 ms 595024 KB Output is correct
24 Correct 279 ms 593556 KB Output is correct
25 Correct 222 ms 595064 KB Output is correct
26 Correct 203 ms 595060 KB Output is correct
27 Correct 194 ms 595028 KB Output is correct
28 Correct 249 ms 593492 KB Output is correct
29 Correct 340 ms 602932 KB Output is correct
30 Correct 268 ms 593748 KB Output is correct
31 Correct 280 ms 603980 KB Output is correct
32 Correct 300 ms 603732 KB Output is correct
33 Correct 340 ms 603028 KB Output is correct
34 Correct 227 ms 602740 KB Output is correct
35 Correct 250 ms 603620 KB Output is correct
36 Correct 291 ms 602704 KB Output is correct
37 Correct 353 ms 603524 KB Output is correct
38 Correct 318 ms 602696 KB Output is correct
39 Correct 1238 ms 741604 KB Output is correct
40 Correct 356 ms 605436 KB Output is correct
41 Correct 288 ms 606804 KB Output is correct
42 Correct 425 ms 609584 KB Output is correct
43 Correct 326 ms 612520 KB Output is correct
44 Correct 654 ms 663852 KB Output is correct
45 Correct 608 ms 669812 KB Output is correct
46 Correct 1110 ms 742096 KB Output is correct
47 Correct 1131 ms 741456 KB Output is correct
48 Correct 1293 ms 741848 KB Output is correct
49 Correct 797 ms 741604 KB Output is correct
50 Correct 754 ms 742844 KB Output is correct
51 Correct 1306 ms 741712 KB Output is correct
52 Correct 1305 ms 741608 KB Output is correct
53 Correct 1417 ms 742992 KB Output is correct
54 Correct 186 ms 589480 KB Output is correct
55 Correct 225 ms 589308 KB Output is correct
56 Correct 210 ms 589432 KB Output is correct
57 Correct 209 ms 589308 KB Output is correct
58 Correct 138 ms 589400 KB Output is correct
59 Correct 296 ms 587436 KB Output is correct
60 Correct 294 ms 587708 KB Output is correct
61 Correct 137 ms 587604 KB Output is correct
62 Correct 283 ms 587596 KB Output is correct
63 Correct 288 ms 587632 KB Output is correct
64 Correct 187 ms 587436 KB Output is correct
65 Correct 289 ms 587640 KB Output is correct
66 Correct 276 ms 587604 KB Output is correct
67 Correct 281 ms 587644 KB Output is correct
68 Correct 215 ms 589652 KB Output is correct
69 Correct 204 ms 589392 KB Output is correct
70 Correct 203 ms 589472 KB Output is correct
71 Correct 216 ms 589728 KB Output is correct
72 Correct 147 ms 589448 KB Output is correct
73 Correct 263 ms 589528 KB Output is correct
74 Correct 286 ms 589624 KB Output is correct
75 Correct 261 ms 589396 KB Output is correct
76 Correct 224 ms 589308 KB Output is correct
77 Correct 214 ms 589508 KB Output is correct
78 Correct 200 ms 589400 KB Output is correct
79 Correct 199 ms 589384 KB Output is correct
80 Correct 205 ms 589516 KB Output is correct
81 Correct 199 ms 589576 KB Output is correct
82 Correct 141 ms 589392 KB Output is correct
83 Correct 139 ms 589596 KB Output is correct
84 Correct 136 ms 589396 KB Output is correct
85 Correct 141 ms 589596 KB Output is correct
86 Correct 138 ms 589360 KB Output is correct
87 Correct 136 ms 589472 KB Output is correct
88 Correct 139 ms 589500 KB Output is correct
89 Correct 138 ms 589408 KB Output is correct
90 Correct 137 ms 589392 KB Output is correct
91 Correct 133 ms 589392 KB Output is correct
92 Correct 138 ms 589504 KB Output is correct
93 Correct 137 ms 589396 KB Output is correct
94 Correct 141 ms 589720 KB Output is correct
95 Correct 134 ms 589600 KB Output is correct
96 Correct 136 ms 589384 KB Output is correct
97 Correct 135 ms 589392 KB Output is correct
98 Correct 135 ms 589396 KB Output is correct
99 Correct 135 ms 589332 KB Output is correct
100 Correct 136 ms 589392 KB Output is correct
101 Correct 136 ms 589396 KB Output is correct
102 Correct 141 ms 589392 KB Output is correct
103 Correct 134 ms 589504 KB Output is correct
104 Correct 138 ms 589400 KB Output is correct
105 Correct 143 ms 589280 KB Output is correct
106 Correct 136 ms 589580 KB Output is correct
107 Correct 135 ms 589400 KB Output is correct
108 Correct 137 ms 589536 KB Output is correct
109 Correct 140 ms 589576 KB Output is correct
110 Correct 150 ms 592980 KB Output is correct
111 Correct 156 ms 594512 KB Output is correct
112 Correct 155 ms 595032 KB Output is correct
113 Correct 162 ms 595056 KB Output is correct
114 Correct 152 ms 595032 KB Output is correct
115 Correct 154 ms 595024 KB Output is correct
116 Correct 165 ms 595208 KB Output is correct
117 Correct 166 ms 595092 KB Output is correct
118 Correct 162 ms 595200 KB Output is correct
119 Correct 189 ms 601012 KB Output is correct
120 Correct 199 ms 603728 KB Output is correct
121 Correct 199 ms 603732 KB Output is correct
122 Correct 183 ms 603476 KB Output is correct
123 Correct 185 ms 603728 KB Output is correct
124 Correct 367 ms 632168 KB Output is correct
125 Correct 942 ms 718552 KB Output is correct
126 Correct 953 ms 742208 KB Output is correct
127 Correct 923 ms 742040 KB Output is correct
128 Correct 637 ms 736592 KB Output is correct
129 Correct 660 ms 736592 KB Output is correct
130 Correct 1254 ms 742460 KB Output is correct
131 Correct 1085 ms 743612 KB Output is correct
132 Correct 145 ms 595052 KB Output is correct
133 Correct 118 ms 589528 KB Output is correct
134 Correct 115 ms 589904 KB Output is correct
135 Correct 130 ms 593000 KB Output is correct
136 Correct 130 ms 593860 KB Output is correct
137 Correct 138 ms 594516 KB Output is correct
138 Correct 138 ms 595280 KB Output is correct
139 Correct 142 ms 594980 KB Output is correct
140 Correct 136 ms 595028 KB Output is correct
141 Correct 142 ms 595244 KB Output is correct
142 Correct 136 ms 595028 KB Output is correct
143 Correct 134 ms 595032 KB Output is correct
144 Correct 135 ms 595244 KB Output is correct
145 Correct 138 ms 595280 KB Output is correct
146 Correct 135 ms 595024 KB Output is correct
147 Correct 136 ms 595024 KB Output is correct
148 Correct 139 ms 595064 KB Output is correct
149 Correct 137 ms 595124 KB Output is correct
150 Correct 142 ms 595028 KB Output is correct
151 Correct 147 ms 595236 KB Output is correct
152 Correct 145 ms 594992 KB Output is correct
153 Correct 141 ms 595224 KB Output is correct
154 Correct 182 ms 603620 KB Output is correct
155 Correct 140 ms 595360 KB Output is correct
156 Correct 169 ms 600912 KB Output is correct
157 Correct 175 ms 602452 KB Output is correct
158 Correct 179 ms 603620 KB Output is correct
159 Correct 195 ms 603728 KB Output is correct
160 Correct 184 ms 603476 KB Output is correct
161 Correct 171 ms 603476 KB Output is correct
162 Correct 166 ms 603460 KB Output is correct
163 Correct 165 ms 603572 KB Output is correct
164 Correct 167 ms 603536 KB Output is correct
165 Correct 167 ms 603700 KB Output is correct
166 Correct 172 ms 603472 KB Output is correct
167 Correct 169 ms 603476 KB Output is correct
168 Correct 174 ms 603472 KB Output is correct
169 Correct 178 ms 603444 KB Output is correct
170 Correct 184 ms 603660 KB Output is correct
171 Correct 195 ms 603728 KB Output is correct
172 Correct 191 ms 603640 KB Output is correct
173 Correct 185 ms 603620 KB Output is correct
174 Correct 209 ms 607936 KB Output is correct
175 Correct 269 ms 623348 KB Output is correct
176 Correct 474 ms 665168 KB Output is correct
177 Correct 619 ms 690768 KB Output is correct
178 Correct 873 ms 720728 KB Output is correct
179 Correct 846 ms 741428 KB Output is correct
180 Correct 897 ms 741624 KB Output is correct
181 Correct 1132 ms 741648 KB Output is correct
182 Correct 1143 ms 741576 KB Output is correct
183 Correct 995 ms 741712 KB Output is correct
184 Execution timed out 2093 ms 894472 KB Time limit exceeded
185 Halted 0 ms 0 KB -