Submission #924164

# Submission time Handle Problem Language Result Execution time Memory
924164 2024-02-08T15:29:39 Z vjudge1 Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 943016 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 long long ll;
typedef pair<ll,ll> ii;
const ll MAXN=6e6+5;

ll a[MAXN];
ll n,m,k;
ll cv(ii x){return m*x.fst+x.snd;}
ii cv(ll x){return {x/m,x%m};}
vector<ii>dir={{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(ii p){
	auto [i,j]=p;
	if(i<0||i>=n||j<0||j>=m)return 0;
	return 1;
}
ll d[MAXN],vis[MAXN];
deque<pair<ii,ll>>q;
set<ll>r[MAXN],c[MAXN];
void go(ii x, ii y, ll g){
	if(vis[cv(y)])return;
	d[cv(y)]=d[cv(x)]+g;
	q.push_front({y,0});
}
ll reach(ii x, ii 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(ii s, ii e){
	mset(d,-1);
	d[cv(s)]=0;
	q.push_front({s,0});
	while(SZ(q)){
		auto [x,g]=q.front(); q.pop_front();
		vis[cv(x)]=1;
		auto [i,j]=x;
		r[i].erase(j);
		c[j].erase(i);
		if(!g){
			for(auto add:dir){
				auto y=x+add;
				if(!allowed(y)||(!g&&a[cv(y)]))continue;
				go(x,y,0);
			}
			q.pb({x,1});
		}
		else {
			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,{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,{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,{*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,{*it,j+k},1);
		}
	}
	return d[cv(e)];
}

int main(){FIN;
	cin>>n>>m>>k;
	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(s,e)<<"\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 243 ms 613032 KB Output is correct
2 Correct 197 ms 613456 KB Output is correct
3 Correct 193 ms 613204 KB Output is correct
4 Correct 191 ms 613196 KB Output is correct
5 Correct 191 ms 613460 KB Output is correct
6 Correct 192 ms 613260 KB Output is correct
7 Correct 192 ms 613288 KB Output is correct
8 Correct 195 ms 613064 KB Output is correct
9 Correct 189 ms 613212 KB Output is correct
10 Correct 193 ms 613128 KB Output is correct
11 Correct 192 ms 613572 KB Output is correct
12 Correct 190 ms 613208 KB Output is correct
13 Correct 191 ms 613204 KB Output is correct
14 Correct 195 ms 613564 KB Output is correct
15 Correct 192 ms 613212 KB Output is correct
16 Correct 191 ms 613200 KB Output is correct
17 Correct 191 ms 613348 KB Output is correct
18 Correct 192 ms 613212 KB Output is correct
19 Correct 219 ms 618836 KB Output is correct
20 Correct 232 ms 617556 KB Output is correct
21 Correct 227 ms 619460 KB Output is correct
22 Correct 228 ms 618832 KB Output is correct
23 Correct 233 ms 618684 KB Output is correct
24 Correct 220 ms 618832 KB Output is correct
25 Correct 219 ms 618696 KB Output is correct
26 Correct 228 ms 618832 KB Output is correct
27 Correct 230 ms 618868 KB Output is correct
28 Correct 224 ms 618692 KB Output is correct
29 Correct 270 ms 627540 KB Output is correct
30 Correct 225 ms 618988 KB Output is correct
31 Correct 305 ms 628560 KB Output is correct
32 Correct 323 ms 627540 KB Output is correct
33 Correct 271 ms 627588 KB Output is correct
34 Correct 268 ms 627540 KB Output is correct
35 Correct 263 ms 627540 KB Output is correct
36 Correct 293 ms 627796 KB Output is correct
37 Correct 289 ms 627604 KB Output is correct
38 Correct 267 ms 627536 KB Output is correct
39 Correct 1193 ms 776776 KB Output is correct
40 Correct 285 ms 629588 KB Output is correct
41 Correct 280 ms 631180 KB Output is correct
42 Correct 317 ms 634704 KB Output is correct
43 Correct 319 ms 637824 KB Output is correct
44 Correct 695 ms 693336 KB Output is correct
45 Correct 642 ms 699260 KB Output is correct
46 Correct 1440 ms 779596 KB Output is correct
47 Correct 1232 ms 776712 KB Output is correct
48 Correct 1231 ms 776384 KB Output is correct
49 Correct 920 ms 776708 KB Output is correct
50 Correct 917 ms 776616 KB Output is correct
51 Correct 1405 ms 776512 KB Output is correct
52 Correct 1358 ms 776528 KB Output is correct
53 Correct 1348 ms 776796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 613204 KB Output is correct
2 Correct 199 ms 613204 KB Output is correct
3 Correct 198 ms 613180 KB Output is correct
4 Correct 199 ms 613132 KB Output is correct
5 Correct 199 ms 613308 KB Output is correct
6 Correct 198 ms 613200 KB Output is correct
7 Correct 198 ms 613200 KB Output is correct
8 Correct 201 ms 613976 KB Output is correct
9 Correct 166 ms 613344 KB Output is correct
10 Correct 159 ms 613204 KB Output is correct
11 Correct 157 ms 613304 KB Output is correct
12 Correct 154 ms 613344 KB Output is correct
13 Correct 152 ms 613204 KB Output is correct
14 Correct 152 ms 613112 KB Output is correct
15 Correct 153 ms 613228 KB Output is correct
16 Correct 146 ms 613204 KB Output is correct
17 Correct 146 ms 613204 KB Output is correct
18 Correct 145 ms 613200 KB Output is correct
19 Correct 146 ms 613200 KB Output is correct
20 Correct 143 ms 613200 KB Output is correct
21 Correct 143 ms 613200 KB Output is correct
22 Correct 146 ms 613084 KB Output is correct
23 Correct 143 ms 613204 KB Output is correct
24 Correct 147 ms 613204 KB Output is correct
25 Correct 146 ms 613200 KB Output is correct
26 Correct 145 ms 613200 KB Output is correct
27 Correct 143 ms 613204 KB Output is correct
28 Correct 141 ms 613204 KB Output is correct
29 Correct 147 ms 613456 KB Output is correct
30 Correct 144 ms 613164 KB Output is correct
31 Correct 145 ms 613200 KB Output is correct
32 Correct 143 ms 613200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 613168 KB Output is correct
2 Correct 144 ms 613080 KB Output is correct
3 Correct 144 ms 613128 KB Output is correct
4 Correct 143 ms 613328 KB Output is correct
5 Correct 146 ms 613200 KB Output is correct
6 Correct 144 ms 613200 KB Output is correct
7 Correct 145 ms 613312 KB Output is correct
8 Correct 143 ms 613204 KB Output is correct
9 Correct 149 ms 613204 KB Output is correct
10 Correct 145 ms 613260 KB Output is correct
11 Correct 144 ms 613248 KB Output is correct
12 Correct 143 ms 613192 KB Output is correct
13 Correct 145 ms 613200 KB Output is correct
14 Correct 146 ms 613200 KB Output is correct
15 Correct 145 ms 613204 KB Output is correct
16 Correct 144 ms 613164 KB Output is correct
17 Correct 143 ms 613240 KB Output is correct
18 Correct 149 ms 613332 KB Output is correct
19 Correct 142 ms 612976 KB Output is correct
20 Correct 142 ms 613228 KB Output is correct
21 Correct 154 ms 613208 KB Output is correct
22 Correct 144 ms 613260 KB Output is correct
23 Correct 145 ms 613316 KB Output is correct
24 Correct 147 ms 613200 KB Output is correct
25 Correct 165 ms 616832 KB Output is correct
26 Correct 170 ms 618672 KB Output is correct
27 Correct 180 ms 619472 KB Output is correct
28 Correct 182 ms 619260 KB Output is correct
29 Correct 164 ms 618836 KB Output is correct
30 Correct 163 ms 618668 KB Output is correct
31 Correct 174 ms 618896 KB Output is correct
32 Correct 179 ms 618836 KB Output is correct
33 Correct 176 ms 618700 KB Output is correct
34 Correct 209 ms 625544 KB Output is correct
35 Correct 227 ms 628528 KB Output is correct
36 Correct 230 ms 628612 KB Output is correct
37 Correct 198 ms 627540 KB Output is correct
38 Correct 191 ms 627280 KB Output is correct
39 Correct 418 ms 661460 KB Output is correct
40 Correct 1136 ms 757168 KB Output is correct
41 Correct 1372 ms 779980 KB Output is correct
42 Correct 1466 ms 779592 KB Output is correct
43 Correct 641 ms 766032 KB Output is correct
44 Correct 662 ms 766036 KB Output is correct
45 Correct 1217 ms 785648 KB Output is correct
46 Correct 1188 ms 785800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 613204 KB Output is correct
2 Correct 199 ms 613204 KB Output is correct
3 Correct 198 ms 613180 KB Output is correct
4 Correct 199 ms 613132 KB Output is correct
5 Correct 199 ms 613308 KB Output is correct
6 Correct 198 ms 613200 KB Output is correct
7 Correct 198 ms 613200 KB Output is correct
8 Correct 201 ms 613976 KB Output is correct
9 Correct 166 ms 613344 KB Output is correct
10 Correct 159 ms 613204 KB Output is correct
11 Correct 157 ms 613304 KB Output is correct
12 Correct 154 ms 613344 KB Output is correct
13 Correct 152 ms 613204 KB Output is correct
14 Correct 152 ms 613112 KB Output is correct
15 Correct 153 ms 613228 KB Output is correct
16 Correct 146 ms 613204 KB Output is correct
17 Correct 146 ms 613204 KB Output is correct
18 Correct 145 ms 613200 KB Output is correct
19 Correct 146 ms 613200 KB Output is correct
20 Correct 143 ms 613200 KB Output is correct
21 Correct 143 ms 613200 KB Output is correct
22 Correct 146 ms 613084 KB Output is correct
23 Correct 143 ms 613204 KB Output is correct
24 Correct 147 ms 613204 KB Output is correct
25 Correct 146 ms 613200 KB Output is correct
26 Correct 145 ms 613200 KB Output is correct
27 Correct 143 ms 613204 KB Output is correct
28 Correct 141 ms 613204 KB Output is correct
29 Correct 147 ms 613456 KB Output is correct
30 Correct 144 ms 613164 KB Output is correct
31 Correct 145 ms 613200 KB Output is correct
32 Correct 143 ms 613200 KB Output is correct
33 Correct 173 ms 619144 KB Output is correct
34 Correct 145 ms 613444 KB Output is correct
35 Correct 145 ms 613460 KB Output is correct
36 Correct 165 ms 616784 KB Output is correct
37 Correct 158 ms 617600 KB Output is correct
38 Correct 169 ms 618576 KB Output is correct
39 Correct 175 ms 619352 KB Output is correct
40 Correct 179 ms 618836 KB Output is correct
41 Correct 173 ms 618888 KB Output is correct
42 Correct 174 ms 619088 KB Output is correct
43 Correct 168 ms 618848 KB Output is correct
44 Correct 163 ms 618832 KB Output is correct
45 Correct 167 ms 618832 KB Output is correct
46 Correct 168 ms 619080 KB Output is correct
47 Correct 168 ms 618740 KB Output is correct
48 Correct 168 ms 618924 KB Output is correct
49 Correct 173 ms 619092 KB Output is correct
50 Correct 171 ms 618924 KB Output is correct
51 Correct 183 ms 618836 KB Output is correct
52 Correct 179 ms 618836 KB Output is correct
53 Correct 174 ms 618832 KB Output is correct
54 Correct 167 ms 618764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 613204 KB Output is correct
2 Correct 199 ms 613204 KB Output is correct
3 Correct 198 ms 613180 KB Output is correct
4 Correct 199 ms 613132 KB Output is correct
5 Correct 199 ms 613308 KB Output is correct
6 Correct 198 ms 613200 KB Output is correct
7 Correct 198 ms 613200 KB Output is correct
8 Correct 201 ms 613976 KB Output is correct
9 Correct 166 ms 613344 KB Output is correct
10 Correct 159 ms 613204 KB Output is correct
11 Correct 157 ms 613304 KB Output is correct
12 Correct 154 ms 613344 KB Output is correct
13 Correct 152 ms 613204 KB Output is correct
14 Correct 152 ms 613112 KB Output is correct
15 Correct 153 ms 613228 KB Output is correct
16 Correct 146 ms 613204 KB Output is correct
17 Correct 146 ms 613204 KB Output is correct
18 Correct 145 ms 613200 KB Output is correct
19 Correct 146 ms 613200 KB Output is correct
20 Correct 143 ms 613200 KB Output is correct
21 Correct 143 ms 613200 KB Output is correct
22 Correct 146 ms 613084 KB Output is correct
23 Correct 143 ms 613204 KB Output is correct
24 Correct 147 ms 613204 KB Output is correct
25 Correct 146 ms 613200 KB Output is correct
26 Correct 145 ms 613200 KB Output is correct
27 Correct 143 ms 613204 KB Output is correct
28 Correct 141 ms 613204 KB Output is correct
29 Correct 147 ms 613456 KB Output is correct
30 Correct 144 ms 613164 KB Output is correct
31 Correct 145 ms 613200 KB Output is correct
32 Correct 143 ms 613200 KB Output is correct
33 Correct 173 ms 619144 KB Output is correct
34 Correct 145 ms 613444 KB Output is correct
35 Correct 145 ms 613460 KB Output is correct
36 Correct 165 ms 616784 KB Output is correct
37 Correct 158 ms 617600 KB Output is correct
38 Correct 169 ms 618576 KB Output is correct
39 Correct 175 ms 619352 KB Output is correct
40 Correct 179 ms 618836 KB Output is correct
41 Correct 173 ms 618888 KB Output is correct
42 Correct 174 ms 619088 KB Output is correct
43 Correct 168 ms 618848 KB Output is correct
44 Correct 163 ms 618832 KB Output is correct
45 Correct 167 ms 618832 KB Output is correct
46 Correct 168 ms 619080 KB Output is correct
47 Correct 168 ms 618740 KB Output is correct
48 Correct 168 ms 618924 KB Output is correct
49 Correct 173 ms 619092 KB Output is correct
50 Correct 171 ms 618924 KB Output is correct
51 Correct 183 ms 618836 KB Output is correct
52 Correct 179 ms 618836 KB Output is correct
53 Correct 174 ms 618832 KB Output is correct
54 Correct 167 ms 618764 KB Output is correct
55 Correct 214 ms 627536 KB Output is correct
56 Correct 171 ms 618836 KB Output is correct
57 Correct 209 ms 625716 KB Output is correct
58 Correct 208 ms 626516 KB Output is correct
59 Correct 225 ms 628552 KB Output is correct
60 Correct 226 ms 627540 KB Output is correct
61 Correct 216 ms 627696 KB Output is correct
62 Correct 228 ms 628500 KB Output is correct
63 Correct 196 ms 627208 KB Output is correct
64 Correct 191 ms 627284 KB Output is correct
65 Correct 202 ms 627540 KB Output is correct
66 Correct 208 ms 627552 KB Output is correct
67 Correct 210 ms 627752 KB Output is correct
68 Correct 215 ms 627592 KB Output is correct
69 Correct 223 ms 627792 KB Output is correct
70 Correct 219 ms 627556 KB Output is correct
71 Correct 220 ms 627748 KB Output is correct
72 Correct 238 ms 627792 KB Output is correct
73 Correct 231 ms 627756 KB Output is correct
74 Correct 217 ms 627540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 243 ms 613032 KB Output is correct
2 Correct 197 ms 613456 KB Output is correct
3 Correct 193 ms 613204 KB Output is correct
4 Correct 191 ms 613196 KB Output is correct
5 Correct 191 ms 613460 KB Output is correct
6 Correct 192 ms 613260 KB Output is correct
7 Correct 192 ms 613288 KB Output is correct
8 Correct 195 ms 613064 KB Output is correct
9 Correct 189 ms 613212 KB Output is correct
10 Correct 193 ms 613128 KB Output is correct
11 Correct 192 ms 613572 KB Output is correct
12 Correct 190 ms 613208 KB Output is correct
13 Correct 191 ms 613204 KB Output is correct
14 Correct 195 ms 613564 KB Output is correct
15 Correct 192 ms 613212 KB Output is correct
16 Correct 191 ms 613200 KB Output is correct
17 Correct 191 ms 613348 KB Output is correct
18 Correct 192 ms 613212 KB Output is correct
19 Correct 219 ms 618836 KB Output is correct
20 Correct 232 ms 617556 KB Output is correct
21 Correct 227 ms 619460 KB Output is correct
22 Correct 228 ms 618832 KB Output is correct
23 Correct 233 ms 618684 KB Output is correct
24 Correct 220 ms 618832 KB Output is correct
25 Correct 219 ms 618696 KB Output is correct
26 Correct 228 ms 618832 KB Output is correct
27 Correct 230 ms 618868 KB Output is correct
28 Correct 224 ms 618692 KB Output is correct
29 Correct 270 ms 627540 KB Output is correct
30 Correct 225 ms 618988 KB Output is correct
31 Correct 305 ms 628560 KB Output is correct
32 Correct 323 ms 627540 KB Output is correct
33 Correct 271 ms 627588 KB Output is correct
34 Correct 268 ms 627540 KB Output is correct
35 Correct 263 ms 627540 KB Output is correct
36 Correct 293 ms 627796 KB Output is correct
37 Correct 289 ms 627604 KB Output is correct
38 Correct 267 ms 627536 KB Output is correct
39 Correct 1193 ms 776776 KB Output is correct
40 Correct 285 ms 629588 KB Output is correct
41 Correct 280 ms 631180 KB Output is correct
42 Correct 317 ms 634704 KB Output is correct
43 Correct 319 ms 637824 KB Output is correct
44 Correct 695 ms 693336 KB Output is correct
45 Correct 642 ms 699260 KB Output is correct
46 Correct 1440 ms 779596 KB Output is correct
47 Correct 1232 ms 776712 KB Output is correct
48 Correct 1231 ms 776384 KB Output is correct
49 Correct 920 ms 776708 KB Output is correct
50 Correct 917 ms 776616 KB Output is correct
51 Correct 1405 ms 776512 KB Output is correct
52 Correct 1358 ms 776528 KB Output is correct
53 Correct 1348 ms 776796 KB Output is correct
54 Correct 196 ms 613204 KB Output is correct
55 Correct 199 ms 613204 KB Output is correct
56 Correct 198 ms 613180 KB Output is correct
57 Correct 199 ms 613132 KB Output is correct
58 Correct 199 ms 613308 KB Output is correct
59 Correct 198 ms 613200 KB Output is correct
60 Correct 198 ms 613200 KB Output is correct
61 Correct 201 ms 613976 KB Output is correct
62 Correct 166 ms 613344 KB Output is correct
63 Correct 159 ms 613204 KB Output is correct
64 Correct 157 ms 613304 KB Output is correct
65 Correct 154 ms 613344 KB Output is correct
66 Correct 152 ms 613204 KB Output is correct
67 Correct 152 ms 613112 KB Output is correct
68 Correct 153 ms 613228 KB Output is correct
69 Correct 146 ms 613204 KB Output is correct
70 Correct 146 ms 613204 KB Output is correct
71 Correct 145 ms 613200 KB Output is correct
72 Correct 146 ms 613200 KB Output is correct
73 Correct 143 ms 613200 KB Output is correct
74 Correct 143 ms 613200 KB Output is correct
75 Correct 146 ms 613084 KB Output is correct
76 Correct 143 ms 613204 KB Output is correct
77 Correct 147 ms 613204 KB Output is correct
78 Correct 146 ms 613200 KB Output is correct
79 Correct 145 ms 613200 KB Output is correct
80 Correct 143 ms 613204 KB Output is correct
81 Correct 141 ms 613204 KB Output is correct
82 Correct 147 ms 613456 KB Output is correct
83 Correct 144 ms 613164 KB Output is correct
84 Correct 145 ms 613200 KB Output is correct
85 Correct 143 ms 613200 KB Output is correct
86 Correct 145 ms 613168 KB Output is correct
87 Correct 144 ms 613080 KB Output is correct
88 Correct 144 ms 613128 KB Output is correct
89 Correct 143 ms 613328 KB Output is correct
90 Correct 146 ms 613200 KB Output is correct
91 Correct 144 ms 613200 KB Output is correct
92 Correct 145 ms 613312 KB Output is correct
93 Correct 143 ms 613204 KB Output is correct
94 Correct 149 ms 613204 KB Output is correct
95 Correct 145 ms 613260 KB Output is correct
96 Correct 144 ms 613248 KB Output is correct
97 Correct 143 ms 613192 KB Output is correct
98 Correct 145 ms 613200 KB Output is correct
99 Correct 146 ms 613200 KB Output is correct
100 Correct 145 ms 613204 KB Output is correct
101 Correct 144 ms 613164 KB Output is correct
102 Correct 143 ms 613240 KB Output is correct
103 Correct 149 ms 613332 KB Output is correct
104 Correct 142 ms 612976 KB Output is correct
105 Correct 142 ms 613228 KB Output is correct
106 Correct 154 ms 613208 KB Output is correct
107 Correct 144 ms 613260 KB Output is correct
108 Correct 145 ms 613316 KB Output is correct
109 Correct 147 ms 613200 KB Output is correct
110 Correct 165 ms 616832 KB Output is correct
111 Correct 170 ms 618672 KB Output is correct
112 Correct 180 ms 619472 KB Output is correct
113 Correct 182 ms 619260 KB Output is correct
114 Correct 164 ms 618836 KB Output is correct
115 Correct 163 ms 618668 KB Output is correct
116 Correct 174 ms 618896 KB Output is correct
117 Correct 179 ms 618836 KB Output is correct
118 Correct 176 ms 618700 KB Output is correct
119 Correct 209 ms 625544 KB Output is correct
120 Correct 227 ms 628528 KB Output is correct
121 Correct 230 ms 628612 KB Output is correct
122 Correct 198 ms 627540 KB Output is correct
123 Correct 191 ms 627280 KB Output is correct
124 Correct 418 ms 661460 KB Output is correct
125 Correct 1136 ms 757168 KB Output is correct
126 Correct 1372 ms 779980 KB Output is correct
127 Correct 1466 ms 779592 KB Output is correct
128 Correct 641 ms 766032 KB Output is correct
129 Correct 662 ms 766036 KB Output is correct
130 Correct 1217 ms 785648 KB Output is correct
131 Correct 1188 ms 785800 KB Output is correct
132 Correct 173 ms 619144 KB Output is correct
133 Correct 145 ms 613444 KB Output is correct
134 Correct 145 ms 613460 KB Output is correct
135 Correct 165 ms 616784 KB Output is correct
136 Correct 158 ms 617600 KB Output is correct
137 Correct 169 ms 618576 KB Output is correct
138 Correct 175 ms 619352 KB Output is correct
139 Correct 179 ms 618836 KB Output is correct
140 Correct 173 ms 618888 KB Output is correct
141 Correct 174 ms 619088 KB Output is correct
142 Correct 168 ms 618848 KB Output is correct
143 Correct 163 ms 618832 KB Output is correct
144 Correct 167 ms 618832 KB Output is correct
145 Correct 168 ms 619080 KB Output is correct
146 Correct 168 ms 618740 KB Output is correct
147 Correct 168 ms 618924 KB Output is correct
148 Correct 173 ms 619092 KB Output is correct
149 Correct 171 ms 618924 KB Output is correct
150 Correct 183 ms 618836 KB Output is correct
151 Correct 179 ms 618836 KB Output is correct
152 Correct 174 ms 618832 KB Output is correct
153 Correct 167 ms 618764 KB Output is correct
154 Correct 214 ms 627536 KB Output is correct
155 Correct 171 ms 618836 KB Output is correct
156 Correct 209 ms 625716 KB Output is correct
157 Correct 208 ms 626516 KB Output is correct
158 Correct 225 ms 628552 KB Output is correct
159 Correct 226 ms 627540 KB Output is correct
160 Correct 216 ms 627696 KB Output is correct
161 Correct 228 ms 628500 KB Output is correct
162 Correct 196 ms 627208 KB Output is correct
163 Correct 191 ms 627284 KB Output is correct
164 Correct 202 ms 627540 KB Output is correct
165 Correct 208 ms 627552 KB Output is correct
166 Correct 210 ms 627752 KB Output is correct
167 Correct 215 ms 627592 KB Output is correct
168 Correct 223 ms 627792 KB Output is correct
169 Correct 219 ms 627556 KB Output is correct
170 Correct 220 ms 627748 KB Output is correct
171 Correct 238 ms 627792 KB Output is correct
172 Correct 231 ms 627756 KB Output is correct
173 Correct 217 ms 627540 KB Output is correct
174 Correct 257 ms 632656 KB Output is correct
175 Correct 319 ms 648016 KB Output is correct
176 Correct 538 ms 696424 KB Output is correct
177 Correct 716 ms 721984 KB Output is correct
178 Correct 995 ms 755528 KB Output is correct
179 Correct 967 ms 776764 KB Output is correct
180 Correct 1159 ms 776732 KB Output is correct
181 Correct 1222 ms 777300 KB Output is correct
182 Correct 1361 ms 777264 KB Output is correct
183 Correct 1149 ms 777860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 243 ms 613032 KB Output is correct
2 Correct 197 ms 613456 KB Output is correct
3 Correct 193 ms 613204 KB Output is correct
4 Correct 191 ms 613196 KB Output is correct
5 Correct 191 ms 613460 KB Output is correct
6 Correct 192 ms 613260 KB Output is correct
7 Correct 192 ms 613288 KB Output is correct
8 Correct 195 ms 613064 KB Output is correct
9 Correct 189 ms 613212 KB Output is correct
10 Correct 193 ms 613128 KB Output is correct
11 Correct 192 ms 613572 KB Output is correct
12 Correct 190 ms 613208 KB Output is correct
13 Correct 191 ms 613204 KB Output is correct
14 Correct 195 ms 613564 KB Output is correct
15 Correct 192 ms 613212 KB Output is correct
16 Correct 191 ms 613200 KB Output is correct
17 Correct 191 ms 613348 KB Output is correct
18 Correct 192 ms 613212 KB Output is correct
19 Correct 219 ms 618836 KB Output is correct
20 Correct 232 ms 617556 KB Output is correct
21 Correct 227 ms 619460 KB Output is correct
22 Correct 228 ms 618832 KB Output is correct
23 Correct 233 ms 618684 KB Output is correct
24 Correct 220 ms 618832 KB Output is correct
25 Correct 219 ms 618696 KB Output is correct
26 Correct 228 ms 618832 KB Output is correct
27 Correct 230 ms 618868 KB Output is correct
28 Correct 224 ms 618692 KB Output is correct
29 Correct 270 ms 627540 KB Output is correct
30 Correct 225 ms 618988 KB Output is correct
31 Correct 305 ms 628560 KB Output is correct
32 Correct 323 ms 627540 KB Output is correct
33 Correct 271 ms 627588 KB Output is correct
34 Correct 268 ms 627540 KB Output is correct
35 Correct 263 ms 627540 KB Output is correct
36 Correct 293 ms 627796 KB Output is correct
37 Correct 289 ms 627604 KB Output is correct
38 Correct 267 ms 627536 KB Output is correct
39 Correct 1193 ms 776776 KB Output is correct
40 Correct 285 ms 629588 KB Output is correct
41 Correct 280 ms 631180 KB Output is correct
42 Correct 317 ms 634704 KB Output is correct
43 Correct 319 ms 637824 KB Output is correct
44 Correct 695 ms 693336 KB Output is correct
45 Correct 642 ms 699260 KB Output is correct
46 Correct 1440 ms 779596 KB Output is correct
47 Correct 1232 ms 776712 KB Output is correct
48 Correct 1231 ms 776384 KB Output is correct
49 Correct 920 ms 776708 KB Output is correct
50 Correct 917 ms 776616 KB Output is correct
51 Correct 1405 ms 776512 KB Output is correct
52 Correct 1358 ms 776528 KB Output is correct
53 Correct 1348 ms 776796 KB Output is correct
54 Correct 196 ms 613204 KB Output is correct
55 Correct 199 ms 613204 KB Output is correct
56 Correct 198 ms 613180 KB Output is correct
57 Correct 199 ms 613132 KB Output is correct
58 Correct 199 ms 613308 KB Output is correct
59 Correct 198 ms 613200 KB Output is correct
60 Correct 198 ms 613200 KB Output is correct
61 Correct 201 ms 613976 KB Output is correct
62 Correct 166 ms 613344 KB Output is correct
63 Correct 159 ms 613204 KB Output is correct
64 Correct 157 ms 613304 KB Output is correct
65 Correct 154 ms 613344 KB Output is correct
66 Correct 152 ms 613204 KB Output is correct
67 Correct 152 ms 613112 KB Output is correct
68 Correct 153 ms 613228 KB Output is correct
69 Correct 146 ms 613204 KB Output is correct
70 Correct 146 ms 613204 KB Output is correct
71 Correct 145 ms 613200 KB Output is correct
72 Correct 146 ms 613200 KB Output is correct
73 Correct 143 ms 613200 KB Output is correct
74 Correct 143 ms 613200 KB Output is correct
75 Correct 146 ms 613084 KB Output is correct
76 Correct 143 ms 613204 KB Output is correct
77 Correct 147 ms 613204 KB Output is correct
78 Correct 146 ms 613200 KB Output is correct
79 Correct 145 ms 613200 KB Output is correct
80 Correct 143 ms 613204 KB Output is correct
81 Correct 141 ms 613204 KB Output is correct
82 Correct 147 ms 613456 KB Output is correct
83 Correct 144 ms 613164 KB Output is correct
84 Correct 145 ms 613200 KB Output is correct
85 Correct 143 ms 613200 KB Output is correct
86 Correct 145 ms 613168 KB Output is correct
87 Correct 144 ms 613080 KB Output is correct
88 Correct 144 ms 613128 KB Output is correct
89 Correct 143 ms 613328 KB Output is correct
90 Correct 146 ms 613200 KB Output is correct
91 Correct 144 ms 613200 KB Output is correct
92 Correct 145 ms 613312 KB Output is correct
93 Correct 143 ms 613204 KB Output is correct
94 Correct 149 ms 613204 KB Output is correct
95 Correct 145 ms 613260 KB Output is correct
96 Correct 144 ms 613248 KB Output is correct
97 Correct 143 ms 613192 KB Output is correct
98 Correct 145 ms 613200 KB Output is correct
99 Correct 146 ms 613200 KB Output is correct
100 Correct 145 ms 613204 KB Output is correct
101 Correct 144 ms 613164 KB Output is correct
102 Correct 143 ms 613240 KB Output is correct
103 Correct 149 ms 613332 KB Output is correct
104 Correct 142 ms 612976 KB Output is correct
105 Correct 142 ms 613228 KB Output is correct
106 Correct 154 ms 613208 KB Output is correct
107 Correct 144 ms 613260 KB Output is correct
108 Correct 145 ms 613316 KB Output is correct
109 Correct 147 ms 613200 KB Output is correct
110 Correct 165 ms 616832 KB Output is correct
111 Correct 170 ms 618672 KB Output is correct
112 Correct 180 ms 619472 KB Output is correct
113 Correct 182 ms 619260 KB Output is correct
114 Correct 164 ms 618836 KB Output is correct
115 Correct 163 ms 618668 KB Output is correct
116 Correct 174 ms 618896 KB Output is correct
117 Correct 179 ms 618836 KB Output is correct
118 Correct 176 ms 618700 KB Output is correct
119 Correct 209 ms 625544 KB Output is correct
120 Correct 227 ms 628528 KB Output is correct
121 Correct 230 ms 628612 KB Output is correct
122 Correct 198 ms 627540 KB Output is correct
123 Correct 191 ms 627280 KB Output is correct
124 Correct 418 ms 661460 KB Output is correct
125 Correct 1136 ms 757168 KB Output is correct
126 Correct 1372 ms 779980 KB Output is correct
127 Correct 1466 ms 779592 KB Output is correct
128 Correct 641 ms 766032 KB Output is correct
129 Correct 662 ms 766036 KB Output is correct
130 Correct 1217 ms 785648 KB Output is correct
131 Correct 1188 ms 785800 KB Output is correct
132 Correct 173 ms 619144 KB Output is correct
133 Correct 145 ms 613444 KB Output is correct
134 Correct 145 ms 613460 KB Output is correct
135 Correct 165 ms 616784 KB Output is correct
136 Correct 158 ms 617600 KB Output is correct
137 Correct 169 ms 618576 KB Output is correct
138 Correct 175 ms 619352 KB Output is correct
139 Correct 179 ms 618836 KB Output is correct
140 Correct 173 ms 618888 KB Output is correct
141 Correct 174 ms 619088 KB Output is correct
142 Correct 168 ms 618848 KB Output is correct
143 Correct 163 ms 618832 KB Output is correct
144 Correct 167 ms 618832 KB Output is correct
145 Correct 168 ms 619080 KB Output is correct
146 Correct 168 ms 618740 KB Output is correct
147 Correct 168 ms 618924 KB Output is correct
148 Correct 173 ms 619092 KB Output is correct
149 Correct 171 ms 618924 KB Output is correct
150 Correct 183 ms 618836 KB Output is correct
151 Correct 179 ms 618836 KB Output is correct
152 Correct 174 ms 618832 KB Output is correct
153 Correct 167 ms 618764 KB Output is correct
154 Correct 214 ms 627536 KB Output is correct
155 Correct 171 ms 618836 KB Output is correct
156 Correct 209 ms 625716 KB Output is correct
157 Correct 208 ms 626516 KB Output is correct
158 Correct 225 ms 628552 KB Output is correct
159 Correct 226 ms 627540 KB Output is correct
160 Correct 216 ms 627696 KB Output is correct
161 Correct 228 ms 628500 KB Output is correct
162 Correct 196 ms 627208 KB Output is correct
163 Correct 191 ms 627284 KB Output is correct
164 Correct 202 ms 627540 KB Output is correct
165 Correct 208 ms 627552 KB Output is correct
166 Correct 210 ms 627752 KB Output is correct
167 Correct 215 ms 627592 KB Output is correct
168 Correct 223 ms 627792 KB Output is correct
169 Correct 219 ms 627556 KB Output is correct
170 Correct 220 ms 627748 KB Output is correct
171 Correct 238 ms 627792 KB Output is correct
172 Correct 231 ms 627756 KB Output is correct
173 Correct 217 ms 627540 KB Output is correct
174 Correct 257 ms 632656 KB Output is correct
175 Correct 319 ms 648016 KB Output is correct
176 Correct 538 ms 696424 KB Output is correct
177 Correct 716 ms 721984 KB Output is correct
178 Correct 995 ms 755528 KB Output is correct
179 Correct 967 ms 776764 KB Output is correct
180 Correct 1159 ms 776732 KB Output is correct
181 Correct 1222 ms 777300 KB Output is correct
182 Correct 1361 ms 777264 KB Output is correct
183 Correct 1149 ms 777860 KB Output is correct
184 Execution timed out 2059 ms 943016 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 243 ms 613032 KB Output is correct
2 Correct 197 ms 613456 KB Output is correct
3 Correct 193 ms 613204 KB Output is correct
4 Correct 191 ms 613196 KB Output is correct
5 Correct 191 ms 613460 KB Output is correct
6 Correct 192 ms 613260 KB Output is correct
7 Correct 192 ms 613288 KB Output is correct
8 Correct 195 ms 613064 KB Output is correct
9 Correct 189 ms 613212 KB Output is correct
10 Correct 193 ms 613128 KB Output is correct
11 Correct 192 ms 613572 KB Output is correct
12 Correct 190 ms 613208 KB Output is correct
13 Correct 191 ms 613204 KB Output is correct
14 Correct 195 ms 613564 KB Output is correct
15 Correct 192 ms 613212 KB Output is correct
16 Correct 191 ms 613200 KB Output is correct
17 Correct 191 ms 613348 KB Output is correct
18 Correct 192 ms 613212 KB Output is correct
19 Correct 219 ms 618836 KB Output is correct
20 Correct 232 ms 617556 KB Output is correct
21 Correct 227 ms 619460 KB Output is correct
22 Correct 228 ms 618832 KB Output is correct
23 Correct 233 ms 618684 KB Output is correct
24 Correct 220 ms 618832 KB Output is correct
25 Correct 219 ms 618696 KB Output is correct
26 Correct 228 ms 618832 KB Output is correct
27 Correct 230 ms 618868 KB Output is correct
28 Correct 224 ms 618692 KB Output is correct
29 Correct 270 ms 627540 KB Output is correct
30 Correct 225 ms 618988 KB Output is correct
31 Correct 305 ms 628560 KB Output is correct
32 Correct 323 ms 627540 KB Output is correct
33 Correct 271 ms 627588 KB Output is correct
34 Correct 268 ms 627540 KB Output is correct
35 Correct 263 ms 627540 KB Output is correct
36 Correct 293 ms 627796 KB Output is correct
37 Correct 289 ms 627604 KB Output is correct
38 Correct 267 ms 627536 KB Output is correct
39 Correct 1193 ms 776776 KB Output is correct
40 Correct 285 ms 629588 KB Output is correct
41 Correct 280 ms 631180 KB Output is correct
42 Correct 317 ms 634704 KB Output is correct
43 Correct 319 ms 637824 KB Output is correct
44 Correct 695 ms 693336 KB Output is correct
45 Correct 642 ms 699260 KB Output is correct
46 Correct 1440 ms 779596 KB Output is correct
47 Correct 1232 ms 776712 KB Output is correct
48 Correct 1231 ms 776384 KB Output is correct
49 Correct 920 ms 776708 KB Output is correct
50 Correct 917 ms 776616 KB Output is correct
51 Correct 1405 ms 776512 KB Output is correct
52 Correct 1358 ms 776528 KB Output is correct
53 Correct 1348 ms 776796 KB Output is correct
54 Correct 196 ms 613204 KB Output is correct
55 Correct 199 ms 613204 KB Output is correct
56 Correct 198 ms 613180 KB Output is correct
57 Correct 199 ms 613132 KB Output is correct
58 Correct 199 ms 613308 KB Output is correct
59 Correct 198 ms 613200 KB Output is correct
60 Correct 198 ms 613200 KB Output is correct
61 Correct 201 ms 613976 KB Output is correct
62 Correct 166 ms 613344 KB Output is correct
63 Correct 159 ms 613204 KB Output is correct
64 Correct 157 ms 613304 KB Output is correct
65 Correct 154 ms 613344 KB Output is correct
66 Correct 152 ms 613204 KB Output is correct
67 Correct 152 ms 613112 KB Output is correct
68 Correct 153 ms 613228 KB Output is correct
69 Correct 146 ms 613204 KB Output is correct
70 Correct 146 ms 613204 KB Output is correct
71 Correct 145 ms 613200 KB Output is correct
72 Correct 146 ms 613200 KB Output is correct
73 Correct 143 ms 613200 KB Output is correct
74 Correct 143 ms 613200 KB Output is correct
75 Correct 146 ms 613084 KB Output is correct
76 Correct 143 ms 613204 KB Output is correct
77 Correct 147 ms 613204 KB Output is correct
78 Correct 146 ms 613200 KB Output is correct
79 Correct 145 ms 613200 KB Output is correct
80 Correct 143 ms 613204 KB Output is correct
81 Correct 141 ms 613204 KB Output is correct
82 Correct 147 ms 613456 KB Output is correct
83 Correct 144 ms 613164 KB Output is correct
84 Correct 145 ms 613200 KB Output is correct
85 Correct 143 ms 613200 KB Output is correct
86 Correct 145 ms 613168 KB Output is correct
87 Correct 144 ms 613080 KB Output is correct
88 Correct 144 ms 613128 KB Output is correct
89 Correct 143 ms 613328 KB Output is correct
90 Correct 146 ms 613200 KB Output is correct
91 Correct 144 ms 613200 KB Output is correct
92 Correct 145 ms 613312 KB Output is correct
93 Correct 143 ms 613204 KB Output is correct
94 Correct 149 ms 613204 KB Output is correct
95 Correct 145 ms 613260 KB Output is correct
96 Correct 144 ms 613248 KB Output is correct
97 Correct 143 ms 613192 KB Output is correct
98 Correct 145 ms 613200 KB Output is correct
99 Correct 146 ms 613200 KB Output is correct
100 Correct 145 ms 613204 KB Output is correct
101 Correct 144 ms 613164 KB Output is correct
102 Correct 143 ms 613240 KB Output is correct
103 Correct 149 ms 613332 KB Output is correct
104 Correct 142 ms 612976 KB Output is correct
105 Correct 142 ms 613228 KB Output is correct
106 Correct 154 ms 613208 KB Output is correct
107 Correct 144 ms 613260 KB Output is correct
108 Correct 145 ms 613316 KB Output is correct
109 Correct 147 ms 613200 KB Output is correct
110 Correct 165 ms 616832 KB Output is correct
111 Correct 170 ms 618672 KB Output is correct
112 Correct 180 ms 619472 KB Output is correct
113 Correct 182 ms 619260 KB Output is correct
114 Correct 164 ms 618836 KB Output is correct
115 Correct 163 ms 618668 KB Output is correct
116 Correct 174 ms 618896 KB Output is correct
117 Correct 179 ms 618836 KB Output is correct
118 Correct 176 ms 618700 KB Output is correct
119 Correct 209 ms 625544 KB Output is correct
120 Correct 227 ms 628528 KB Output is correct
121 Correct 230 ms 628612 KB Output is correct
122 Correct 198 ms 627540 KB Output is correct
123 Correct 191 ms 627280 KB Output is correct
124 Correct 418 ms 661460 KB Output is correct
125 Correct 1136 ms 757168 KB Output is correct
126 Correct 1372 ms 779980 KB Output is correct
127 Correct 1466 ms 779592 KB Output is correct
128 Correct 641 ms 766032 KB Output is correct
129 Correct 662 ms 766036 KB Output is correct
130 Correct 1217 ms 785648 KB Output is correct
131 Correct 1188 ms 785800 KB Output is correct
132 Correct 173 ms 619144 KB Output is correct
133 Correct 145 ms 613444 KB Output is correct
134 Correct 145 ms 613460 KB Output is correct
135 Correct 165 ms 616784 KB Output is correct
136 Correct 158 ms 617600 KB Output is correct
137 Correct 169 ms 618576 KB Output is correct
138 Correct 175 ms 619352 KB Output is correct
139 Correct 179 ms 618836 KB Output is correct
140 Correct 173 ms 618888 KB Output is correct
141 Correct 174 ms 619088 KB Output is correct
142 Correct 168 ms 618848 KB Output is correct
143 Correct 163 ms 618832 KB Output is correct
144 Correct 167 ms 618832 KB Output is correct
145 Correct 168 ms 619080 KB Output is correct
146 Correct 168 ms 618740 KB Output is correct
147 Correct 168 ms 618924 KB Output is correct
148 Correct 173 ms 619092 KB Output is correct
149 Correct 171 ms 618924 KB Output is correct
150 Correct 183 ms 618836 KB Output is correct
151 Correct 179 ms 618836 KB Output is correct
152 Correct 174 ms 618832 KB Output is correct
153 Correct 167 ms 618764 KB Output is correct
154 Correct 214 ms 627536 KB Output is correct
155 Correct 171 ms 618836 KB Output is correct
156 Correct 209 ms 625716 KB Output is correct
157 Correct 208 ms 626516 KB Output is correct
158 Correct 225 ms 628552 KB Output is correct
159 Correct 226 ms 627540 KB Output is correct
160 Correct 216 ms 627696 KB Output is correct
161 Correct 228 ms 628500 KB Output is correct
162 Correct 196 ms 627208 KB Output is correct
163 Correct 191 ms 627284 KB Output is correct
164 Correct 202 ms 627540 KB Output is correct
165 Correct 208 ms 627552 KB Output is correct
166 Correct 210 ms 627752 KB Output is correct
167 Correct 215 ms 627592 KB Output is correct
168 Correct 223 ms 627792 KB Output is correct
169 Correct 219 ms 627556 KB Output is correct
170 Correct 220 ms 627748 KB Output is correct
171 Correct 238 ms 627792 KB Output is correct
172 Correct 231 ms 627756 KB Output is correct
173 Correct 217 ms 627540 KB Output is correct
174 Correct 257 ms 632656 KB Output is correct
175 Correct 319 ms 648016 KB Output is correct
176 Correct 538 ms 696424 KB Output is correct
177 Correct 716 ms 721984 KB Output is correct
178 Correct 995 ms 755528 KB Output is correct
179 Correct 967 ms 776764 KB Output is correct
180 Correct 1159 ms 776732 KB Output is correct
181 Correct 1222 ms 777300 KB Output is correct
182 Correct 1361 ms 777264 KB Output is correct
183 Correct 1149 ms 777860 KB Output is correct
184 Execution timed out 2059 ms 943016 KB Time limit exceeded
185 Halted 0 ms 0 KB -