Submission #924167

# Submission time Handle Problem Language Result Execution time Memory
924167 2024-02-08T15:37:35 Z Edu175 Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 940152 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];
vector<ii>pop;
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});
	vis[cv(y)]=1;
	pop.pb(y);
}
void popit(){
	for(auto [i,j]:pop)r[i].erase(j),c[j].erase(i);
	pop.clear();
}
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();
		
		if(!g){
			for(auto add:dir){
				auto y=x+add;
				if(!allowed(y)||(!g&&a[cv(y)]))continue;
				go(x,y,0);
				popit();
			}
			q.pb({x,1});
		}
		else {
			auto [i,j]=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,{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);
			popit();
		}
	}
	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 145 ms 613204 KB Output is correct
2 Correct 142 ms 613112 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 144 ms 613204 KB Output is correct
5 Correct 148 ms 613200 KB Output is correct
6 Correct 145 ms 613268 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 145 ms 613164 KB Output is correct
9 Correct 143 ms 613204 KB Output is correct
10 Correct 146 ms 612964 KB Output is correct
11 Correct 148 ms 613016 KB Output is correct
12 Correct 145 ms 613008 KB Output is correct
13 Correct 144 ms 613152 KB Output is correct
14 Correct 152 ms 613088 KB Output is correct
15 Correct 154 ms 613088 KB Output is correct
16 Correct 171 ms 613248 KB Output is correct
17 Correct 145 ms 613308 KB Output is correct
18 Correct 146 ms 613460 KB Output is correct
19 Correct 170 ms 618832 KB Output is correct
20 Correct 159 ms 617556 KB Output is correct
21 Correct 176 ms 619124 KB Output is correct
22 Correct 188 ms 618836 KB Output is correct
23 Correct 166 ms 618840 KB Output is correct
24 Correct 168 ms 618856 KB Output is correct
25 Correct 169 ms 618836 KB Output is correct
26 Correct 174 ms 618832 KB Output is correct
27 Correct 172 ms 618836 KB Output is correct
28 Correct 169 ms 618924 KB Output is correct
29 Correct 215 ms 627608 KB Output is correct
30 Correct 170 ms 618980 KB Output is correct
31 Correct 215 ms 627908 KB Output is correct
32 Correct 222 ms 627512 KB Output is correct
33 Correct 210 ms 627400 KB Output is correct
34 Correct 203 ms 627636 KB Output is correct
35 Correct 197 ms 627536 KB Output is correct
36 Correct 223 ms 627540 KB Output is correct
37 Correct 233 ms 627588 KB Output is correct
38 Correct 212 ms 627536 KB Output is correct
39 Correct 1063 ms 775384 KB Output is correct
40 Correct 228 ms 629840 KB Output is correct
41 Correct 213 ms 631228 KB Output is correct
42 Correct 249 ms 634508 KB Output is correct
43 Correct 257 ms 637472 KB Output is correct
44 Correct 561 ms 692180 KB Output is correct
45 Correct 550 ms 698964 KB Output is correct
46 Correct 1037 ms 776532 KB Output is correct
47 Correct 1091 ms 775116 KB Output is correct
48 Correct 1213 ms 775504 KB Output is correct
49 Correct 777 ms 775508 KB Output is correct
50 Correct 753 ms 776572 KB Output is correct
51 Correct 1268 ms 775616 KB Output is correct
52 Correct 1220 ms 775508 KB Output is correct
53 Correct 1202 ms 775496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 613048 KB Output is correct
2 Correct 147 ms 613212 KB Output is correct
3 Correct 149 ms 613260 KB Output is correct
4 Correct 146 ms 613204 KB Output is correct
5 Correct 149 ms 613064 KB Output is correct
6 Correct 147 ms 613204 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 143 ms 613200 KB Output is correct
9 Correct 143 ms 613204 KB Output is correct
10 Correct 145 ms 613284 KB Output is correct
11 Correct 147 ms 613204 KB Output is correct
12 Correct 144 ms 613244 KB Output is correct
13 Correct 145 ms 613204 KB Output is correct
14 Correct 145 ms 613200 KB Output is correct
15 Correct 145 ms 613076 KB Output is correct
16 Correct 147 ms 613304 KB Output is correct
17 Correct 146 ms 613200 KB Output is correct
18 Correct 145 ms 613348 KB Output is correct
19 Correct 144 ms 613292 KB Output is correct
20 Correct 146 ms 613008 KB Output is correct
21 Correct 143 ms 612996 KB Output is correct
22 Correct 144 ms 613368 KB Output is correct
23 Correct 144 ms 613200 KB Output is correct
24 Correct 144 ms 613208 KB Output is correct
25 Correct 142 ms 613204 KB Output is correct
26 Correct 147 ms 613204 KB Output is correct
27 Correct 144 ms 613020 KB Output is correct
28 Correct 148 ms 613136 KB Output is correct
29 Correct 147 ms 613456 KB Output is correct
30 Correct 144 ms 613200 KB Output is correct
31 Correct 144 ms 613232 KB Output is correct
32 Correct 144 ms 613180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 613200 KB Output is correct
2 Correct 146 ms 613020 KB Output is correct
3 Correct 141 ms 613208 KB Output is correct
4 Correct 146 ms 613300 KB Output is correct
5 Correct 146 ms 613212 KB Output is correct
6 Correct 143 ms 613128 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 148 ms 613200 KB Output is correct
9 Correct 145 ms 613308 KB Output is correct
10 Correct 144 ms 613200 KB Output is correct
11 Correct 146 ms 613112 KB Output is correct
12 Correct 144 ms 613104 KB Output is correct
13 Correct 142 ms 612976 KB Output is correct
14 Correct 145 ms 613204 KB Output is correct
15 Correct 148 ms 613456 KB Output is correct
16 Correct 150 ms 613112 KB Output is correct
17 Correct 148 ms 613156 KB Output is correct
18 Correct 146 ms 613056 KB Output is correct
19 Correct 144 ms 613204 KB Output is correct
20 Correct 146 ms 613044 KB Output is correct
21 Correct 146 ms 613208 KB Output is correct
22 Correct 146 ms 613444 KB Output is correct
23 Correct 148 ms 613060 KB Output is correct
24 Correct 151 ms 613200 KB Output is correct
25 Correct 167 ms 616788 KB Output is correct
26 Correct 167 ms 618340 KB Output is correct
27 Correct 169 ms 618832 KB Output is correct
28 Correct 166 ms 618844 KB Output is correct
29 Correct 165 ms 619000 KB Output is correct
30 Correct 163 ms 618580 KB Output is correct
31 Correct 168 ms 618880 KB Output is correct
32 Correct 172 ms 618792 KB Output is correct
33 Correct 176 ms 619084 KB Output is correct
34 Correct 203 ms 625072 KB Output is correct
35 Correct 207 ms 627792 KB Output is correct
36 Correct 208 ms 627772 KB Output is correct
37 Correct 196 ms 627248 KB Output is correct
38 Correct 189 ms 627276 KB Output is correct
39 Correct 394 ms 659504 KB Output is correct
40 Correct 989 ms 751768 KB Output is correct
41 Correct 1048 ms 776596 KB Output is correct
42 Correct 976 ms 776656 KB Output is correct
43 Correct 637 ms 764624 KB Output is correct
44 Correct 651 ms 764544 KB Output is correct
45 Correct 1123 ms 777112 KB Output is correct
46 Correct 1085 ms 777280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 613048 KB Output is correct
2 Correct 147 ms 613212 KB Output is correct
3 Correct 149 ms 613260 KB Output is correct
4 Correct 146 ms 613204 KB Output is correct
5 Correct 149 ms 613064 KB Output is correct
6 Correct 147 ms 613204 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 143 ms 613200 KB Output is correct
9 Correct 143 ms 613204 KB Output is correct
10 Correct 145 ms 613284 KB Output is correct
11 Correct 147 ms 613204 KB Output is correct
12 Correct 144 ms 613244 KB Output is correct
13 Correct 145 ms 613204 KB Output is correct
14 Correct 145 ms 613200 KB Output is correct
15 Correct 145 ms 613076 KB Output is correct
16 Correct 147 ms 613304 KB Output is correct
17 Correct 146 ms 613200 KB Output is correct
18 Correct 145 ms 613348 KB Output is correct
19 Correct 144 ms 613292 KB Output is correct
20 Correct 146 ms 613008 KB Output is correct
21 Correct 143 ms 612996 KB Output is correct
22 Correct 144 ms 613368 KB Output is correct
23 Correct 144 ms 613200 KB Output is correct
24 Correct 144 ms 613208 KB Output is correct
25 Correct 142 ms 613204 KB Output is correct
26 Correct 147 ms 613204 KB Output is correct
27 Correct 144 ms 613020 KB Output is correct
28 Correct 148 ms 613136 KB Output is correct
29 Correct 147 ms 613456 KB Output is correct
30 Correct 144 ms 613200 KB Output is correct
31 Correct 144 ms 613232 KB Output is correct
32 Correct 144 ms 613180 KB Output is correct
33 Correct 175 ms 618776 KB Output is correct
34 Correct 144 ms 613240 KB Output is correct
35 Correct 146 ms 613620 KB Output is correct
36 Correct 163 ms 616784 KB Output is correct
37 Correct 157 ms 617500 KB Output is correct
38 Correct 166 ms 618320 KB Output is correct
39 Correct 168 ms 619092 KB Output is correct
40 Correct 173 ms 618800 KB Output is correct
41 Correct 167 ms 618832 KB Output is correct
42 Correct 167 ms 618796 KB Output is correct
43 Correct 161 ms 618576 KB Output is correct
44 Correct 168 ms 618712 KB Output is correct
45 Correct 168 ms 618836 KB Output is correct
46 Correct 168 ms 618940 KB Output is correct
47 Correct 165 ms 618840 KB Output is correct
48 Correct 168 ms 618836 KB Output is correct
49 Correct 167 ms 618832 KB Output is correct
50 Correct 168 ms 618700 KB Output is correct
51 Correct 168 ms 618820 KB Output is correct
52 Correct 170 ms 618828 KB Output is correct
53 Correct 175 ms 618816 KB Output is correct
54 Correct 166 ms 618840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 613048 KB Output is correct
2 Correct 147 ms 613212 KB Output is correct
3 Correct 149 ms 613260 KB Output is correct
4 Correct 146 ms 613204 KB Output is correct
5 Correct 149 ms 613064 KB Output is correct
6 Correct 147 ms 613204 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 143 ms 613200 KB Output is correct
9 Correct 143 ms 613204 KB Output is correct
10 Correct 145 ms 613284 KB Output is correct
11 Correct 147 ms 613204 KB Output is correct
12 Correct 144 ms 613244 KB Output is correct
13 Correct 145 ms 613204 KB Output is correct
14 Correct 145 ms 613200 KB Output is correct
15 Correct 145 ms 613076 KB Output is correct
16 Correct 147 ms 613304 KB Output is correct
17 Correct 146 ms 613200 KB Output is correct
18 Correct 145 ms 613348 KB Output is correct
19 Correct 144 ms 613292 KB Output is correct
20 Correct 146 ms 613008 KB Output is correct
21 Correct 143 ms 612996 KB Output is correct
22 Correct 144 ms 613368 KB Output is correct
23 Correct 144 ms 613200 KB Output is correct
24 Correct 144 ms 613208 KB Output is correct
25 Correct 142 ms 613204 KB Output is correct
26 Correct 147 ms 613204 KB Output is correct
27 Correct 144 ms 613020 KB Output is correct
28 Correct 148 ms 613136 KB Output is correct
29 Correct 147 ms 613456 KB Output is correct
30 Correct 144 ms 613200 KB Output is correct
31 Correct 144 ms 613232 KB Output is correct
32 Correct 144 ms 613180 KB Output is correct
33 Correct 175 ms 618776 KB Output is correct
34 Correct 144 ms 613240 KB Output is correct
35 Correct 146 ms 613620 KB Output is correct
36 Correct 163 ms 616784 KB Output is correct
37 Correct 157 ms 617500 KB Output is correct
38 Correct 166 ms 618320 KB Output is correct
39 Correct 168 ms 619092 KB Output is correct
40 Correct 173 ms 618800 KB Output is correct
41 Correct 167 ms 618832 KB Output is correct
42 Correct 167 ms 618796 KB Output is correct
43 Correct 161 ms 618576 KB Output is correct
44 Correct 168 ms 618712 KB Output is correct
45 Correct 168 ms 618836 KB Output is correct
46 Correct 168 ms 618940 KB Output is correct
47 Correct 165 ms 618840 KB Output is correct
48 Correct 168 ms 618836 KB Output is correct
49 Correct 167 ms 618832 KB Output is correct
50 Correct 168 ms 618700 KB Output is correct
51 Correct 168 ms 618820 KB Output is correct
52 Correct 170 ms 618828 KB Output is correct
53 Correct 175 ms 618816 KB Output is correct
54 Correct 166 ms 618840 KB Output is correct
55 Correct 214 ms 627604 KB Output is correct
56 Correct 170 ms 618932 KB Output is correct
57 Correct 203 ms 624920 KB Output is correct
58 Correct 206 ms 626068 KB Output is correct
59 Correct 211 ms 628000 KB Output is correct
60 Correct 222 ms 627504 KB Output is correct
61 Correct 216 ms 627536 KB Output is correct
62 Correct 208 ms 627720 KB Output is correct
63 Correct 194 ms 627300 KB Output is correct
64 Correct 200 ms 627284 KB Output is correct
65 Correct 200 ms 627720 KB Output is correct
66 Correct 195 ms 627608 KB Output is correct
67 Correct 200 ms 627608 KB Output is correct
68 Correct 212 ms 627532 KB Output is correct
69 Correct 212 ms 627536 KB Output is correct
70 Correct 208 ms 627556 KB Output is correct
71 Correct 217 ms 627792 KB Output is correct
72 Correct 228 ms 627536 KB Output is correct
73 Correct 224 ms 627540 KB Output is correct
74 Correct 213 ms 627716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 613204 KB Output is correct
2 Correct 142 ms 613112 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 144 ms 613204 KB Output is correct
5 Correct 148 ms 613200 KB Output is correct
6 Correct 145 ms 613268 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 145 ms 613164 KB Output is correct
9 Correct 143 ms 613204 KB Output is correct
10 Correct 146 ms 612964 KB Output is correct
11 Correct 148 ms 613016 KB Output is correct
12 Correct 145 ms 613008 KB Output is correct
13 Correct 144 ms 613152 KB Output is correct
14 Correct 152 ms 613088 KB Output is correct
15 Correct 154 ms 613088 KB Output is correct
16 Correct 171 ms 613248 KB Output is correct
17 Correct 145 ms 613308 KB Output is correct
18 Correct 146 ms 613460 KB Output is correct
19 Correct 170 ms 618832 KB Output is correct
20 Correct 159 ms 617556 KB Output is correct
21 Correct 176 ms 619124 KB Output is correct
22 Correct 188 ms 618836 KB Output is correct
23 Correct 166 ms 618840 KB Output is correct
24 Correct 168 ms 618856 KB Output is correct
25 Correct 169 ms 618836 KB Output is correct
26 Correct 174 ms 618832 KB Output is correct
27 Correct 172 ms 618836 KB Output is correct
28 Correct 169 ms 618924 KB Output is correct
29 Correct 215 ms 627608 KB Output is correct
30 Correct 170 ms 618980 KB Output is correct
31 Correct 215 ms 627908 KB Output is correct
32 Correct 222 ms 627512 KB Output is correct
33 Correct 210 ms 627400 KB Output is correct
34 Correct 203 ms 627636 KB Output is correct
35 Correct 197 ms 627536 KB Output is correct
36 Correct 223 ms 627540 KB Output is correct
37 Correct 233 ms 627588 KB Output is correct
38 Correct 212 ms 627536 KB Output is correct
39 Correct 1063 ms 775384 KB Output is correct
40 Correct 228 ms 629840 KB Output is correct
41 Correct 213 ms 631228 KB Output is correct
42 Correct 249 ms 634508 KB Output is correct
43 Correct 257 ms 637472 KB Output is correct
44 Correct 561 ms 692180 KB Output is correct
45 Correct 550 ms 698964 KB Output is correct
46 Correct 1037 ms 776532 KB Output is correct
47 Correct 1091 ms 775116 KB Output is correct
48 Correct 1213 ms 775504 KB Output is correct
49 Correct 777 ms 775508 KB Output is correct
50 Correct 753 ms 776572 KB Output is correct
51 Correct 1268 ms 775616 KB Output is correct
52 Correct 1220 ms 775508 KB Output is correct
53 Correct 1202 ms 775496 KB Output is correct
54 Correct 144 ms 613048 KB Output is correct
55 Correct 147 ms 613212 KB Output is correct
56 Correct 149 ms 613260 KB Output is correct
57 Correct 146 ms 613204 KB Output is correct
58 Correct 149 ms 613064 KB Output is correct
59 Correct 147 ms 613204 KB Output is correct
60 Correct 147 ms 613204 KB Output is correct
61 Correct 143 ms 613200 KB Output is correct
62 Correct 143 ms 613204 KB Output is correct
63 Correct 145 ms 613284 KB Output is correct
64 Correct 147 ms 613204 KB Output is correct
65 Correct 144 ms 613244 KB Output is correct
66 Correct 145 ms 613204 KB Output is correct
67 Correct 145 ms 613200 KB Output is correct
68 Correct 145 ms 613076 KB Output is correct
69 Correct 147 ms 613304 KB Output is correct
70 Correct 146 ms 613200 KB Output is correct
71 Correct 145 ms 613348 KB Output is correct
72 Correct 144 ms 613292 KB Output is correct
73 Correct 146 ms 613008 KB Output is correct
74 Correct 143 ms 612996 KB Output is correct
75 Correct 144 ms 613368 KB Output is correct
76 Correct 144 ms 613200 KB Output is correct
77 Correct 144 ms 613208 KB Output is correct
78 Correct 142 ms 613204 KB Output is correct
79 Correct 147 ms 613204 KB Output is correct
80 Correct 144 ms 613020 KB Output is correct
81 Correct 148 ms 613136 KB Output is correct
82 Correct 147 ms 613456 KB Output is correct
83 Correct 144 ms 613200 KB Output is correct
84 Correct 144 ms 613232 KB Output is correct
85 Correct 144 ms 613180 KB Output is correct
86 Correct 143 ms 613200 KB Output is correct
87 Correct 146 ms 613020 KB Output is correct
88 Correct 141 ms 613208 KB Output is correct
89 Correct 146 ms 613300 KB Output is correct
90 Correct 146 ms 613212 KB Output is correct
91 Correct 143 ms 613128 KB Output is correct
92 Correct 147 ms 613204 KB Output is correct
93 Correct 148 ms 613200 KB Output is correct
94 Correct 145 ms 613308 KB Output is correct
95 Correct 144 ms 613200 KB Output is correct
96 Correct 146 ms 613112 KB Output is correct
97 Correct 144 ms 613104 KB Output is correct
98 Correct 142 ms 612976 KB Output is correct
99 Correct 145 ms 613204 KB Output is correct
100 Correct 148 ms 613456 KB Output is correct
101 Correct 150 ms 613112 KB Output is correct
102 Correct 148 ms 613156 KB Output is correct
103 Correct 146 ms 613056 KB Output is correct
104 Correct 144 ms 613204 KB Output is correct
105 Correct 146 ms 613044 KB Output is correct
106 Correct 146 ms 613208 KB Output is correct
107 Correct 146 ms 613444 KB Output is correct
108 Correct 148 ms 613060 KB Output is correct
109 Correct 151 ms 613200 KB Output is correct
110 Correct 167 ms 616788 KB Output is correct
111 Correct 167 ms 618340 KB Output is correct
112 Correct 169 ms 618832 KB Output is correct
113 Correct 166 ms 618844 KB Output is correct
114 Correct 165 ms 619000 KB Output is correct
115 Correct 163 ms 618580 KB Output is correct
116 Correct 168 ms 618880 KB Output is correct
117 Correct 172 ms 618792 KB Output is correct
118 Correct 176 ms 619084 KB Output is correct
119 Correct 203 ms 625072 KB Output is correct
120 Correct 207 ms 627792 KB Output is correct
121 Correct 208 ms 627772 KB Output is correct
122 Correct 196 ms 627248 KB Output is correct
123 Correct 189 ms 627276 KB Output is correct
124 Correct 394 ms 659504 KB Output is correct
125 Correct 989 ms 751768 KB Output is correct
126 Correct 1048 ms 776596 KB Output is correct
127 Correct 976 ms 776656 KB Output is correct
128 Correct 637 ms 764624 KB Output is correct
129 Correct 651 ms 764544 KB Output is correct
130 Correct 1123 ms 777112 KB Output is correct
131 Correct 1085 ms 777280 KB Output is correct
132 Correct 175 ms 618776 KB Output is correct
133 Correct 144 ms 613240 KB Output is correct
134 Correct 146 ms 613620 KB Output is correct
135 Correct 163 ms 616784 KB Output is correct
136 Correct 157 ms 617500 KB Output is correct
137 Correct 166 ms 618320 KB Output is correct
138 Correct 168 ms 619092 KB Output is correct
139 Correct 173 ms 618800 KB Output is correct
140 Correct 167 ms 618832 KB Output is correct
141 Correct 167 ms 618796 KB Output is correct
142 Correct 161 ms 618576 KB Output is correct
143 Correct 168 ms 618712 KB Output is correct
144 Correct 168 ms 618836 KB Output is correct
145 Correct 168 ms 618940 KB Output is correct
146 Correct 165 ms 618840 KB Output is correct
147 Correct 168 ms 618836 KB Output is correct
148 Correct 167 ms 618832 KB Output is correct
149 Correct 168 ms 618700 KB Output is correct
150 Correct 168 ms 618820 KB Output is correct
151 Correct 170 ms 618828 KB Output is correct
152 Correct 175 ms 618816 KB Output is correct
153 Correct 166 ms 618840 KB Output is correct
154 Correct 214 ms 627604 KB Output is correct
155 Correct 170 ms 618932 KB Output is correct
156 Correct 203 ms 624920 KB Output is correct
157 Correct 206 ms 626068 KB Output is correct
158 Correct 211 ms 628000 KB Output is correct
159 Correct 222 ms 627504 KB Output is correct
160 Correct 216 ms 627536 KB Output is correct
161 Correct 208 ms 627720 KB Output is correct
162 Correct 194 ms 627300 KB Output is correct
163 Correct 200 ms 627284 KB Output is correct
164 Correct 200 ms 627720 KB Output is correct
165 Correct 195 ms 627608 KB Output is correct
166 Correct 200 ms 627608 KB Output is correct
167 Correct 212 ms 627532 KB Output is correct
168 Correct 212 ms 627536 KB Output is correct
169 Correct 208 ms 627556 KB Output is correct
170 Correct 217 ms 627792 KB Output is correct
171 Correct 228 ms 627536 KB Output is correct
172 Correct 224 ms 627540 KB Output is correct
173 Correct 213 ms 627716 KB Output is correct
174 Correct 247 ms 632508 KB Output is correct
175 Correct 307 ms 647764 KB Output is correct
176 Correct 500 ms 694356 KB Output is correct
177 Correct 678 ms 720956 KB Output is correct
178 Correct 931 ms 754364 KB Output is correct
179 Correct 888 ms 775320 KB Output is correct
180 Correct 1034 ms 775460 KB Output is correct
181 Correct 1123 ms 775524 KB Output is correct
182 Correct 1246 ms 776508 KB Output is correct
183 Correct 1049 ms 775740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 613204 KB Output is correct
2 Correct 142 ms 613112 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 144 ms 613204 KB Output is correct
5 Correct 148 ms 613200 KB Output is correct
6 Correct 145 ms 613268 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 145 ms 613164 KB Output is correct
9 Correct 143 ms 613204 KB Output is correct
10 Correct 146 ms 612964 KB Output is correct
11 Correct 148 ms 613016 KB Output is correct
12 Correct 145 ms 613008 KB Output is correct
13 Correct 144 ms 613152 KB Output is correct
14 Correct 152 ms 613088 KB Output is correct
15 Correct 154 ms 613088 KB Output is correct
16 Correct 171 ms 613248 KB Output is correct
17 Correct 145 ms 613308 KB Output is correct
18 Correct 146 ms 613460 KB Output is correct
19 Correct 170 ms 618832 KB Output is correct
20 Correct 159 ms 617556 KB Output is correct
21 Correct 176 ms 619124 KB Output is correct
22 Correct 188 ms 618836 KB Output is correct
23 Correct 166 ms 618840 KB Output is correct
24 Correct 168 ms 618856 KB Output is correct
25 Correct 169 ms 618836 KB Output is correct
26 Correct 174 ms 618832 KB Output is correct
27 Correct 172 ms 618836 KB Output is correct
28 Correct 169 ms 618924 KB Output is correct
29 Correct 215 ms 627608 KB Output is correct
30 Correct 170 ms 618980 KB Output is correct
31 Correct 215 ms 627908 KB Output is correct
32 Correct 222 ms 627512 KB Output is correct
33 Correct 210 ms 627400 KB Output is correct
34 Correct 203 ms 627636 KB Output is correct
35 Correct 197 ms 627536 KB Output is correct
36 Correct 223 ms 627540 KB Output is correct
37 Correct 233 ms 627588 KB Output is correct
38 Correct 212 ms 627536 KB Output is correct
39 Correct 1063 ms 775384 KB Output is correct
40 Correct 228 ms 629840 KB Output is correct
41 Correct 213 ms 631228 KB Output is correct
42 Correct 249 ms 634508 KB Output is correct
43 Correct 257 ms 637472 KB Output is correct
44 Correct 561 ms 692180 KB Output is correct
45 Correct 550 ms 698964 KB Output is correct
46 Correct 1037 ms 776532 KB Output is correct
47 Correct 1091 ms 775116 KB Output is correct
48 Correct 1213 ms 775504 KB Output is correct
49 Correct 777 ms 775508 KB Output is correct
50 Correct 753 ms 776572 KB Output is correct
51 Correct 1268 ms 775616 KB Output is correct
52 Correct 1220 ms 775508 KB Output is correct
53 Correct 1202 ms 775496 KB Output is correct
54 Correct 144 ms 613048 KB Output is correct
55 Correct 147 ms 613212 KB Output is correct
56 Correct 149 ms 613260 KB Output is correct
57 Correct 146 ms 613204 KB Output is correct
58 Correct 149 ms 613064 KB Output is correct
59 Correct 147 ms 613204 KB Output is correct
60 Correct 147 ms 613204 KB Output is correct
61 Correct 143 ms 613200 KB Output is correct
62 Correct 143 ms 613204 KB Output is correct
63 Correct 145 ms 613284 KB Output is correct
64 Correct 147 ms 613204 KB Output is correct
65 Correct 144 ms 613244 KB Output is correct
66 Correct 145 ms 613204 KB Output is correct
67 Correct 145 ms 613200 KB Output is correct
68 Correct 145 ms 613076 KB Output is correct
69 Correct 147 ms 613304 KB Output is correct
70 Correct 146 ms 613200 KB Output is correct
71 Correct 145 ms 613348 KB Output is correct
72 Correct 144 ms 613292 KB Output is correct
73 Correct 146 ms 613008 KB Output is correct
74 Correct 143 ms 612996 KB Output is correct
75 Correct 144 ms 613368 KB Output is correct
76 Correct 144 ms 613200 KB Output is correct
77 Correct 144 ms 613208 KB Output is correct
78 Correct 142 ms 613204 KB Output is correct
79 Correct 147 ms 613204 KB Output is correct
80 Correct 144 ms 613020 KB Output is correct
81 Correct 148 ms 613136 KB Output is correct
82 Correct 147 ms 613456 KB Output is correct
83 Correct 144 ms 613200 KB Output is correct
84 Correct 144 ms 613232 KB Output is correct
85 Correct 144 ms 613180 KB Output is correct
86 Correct 143 ms 613200 KB Output is correct
87 Correct 146 ms 613020 KB Output is correct
88 Correct 141 ms 613208 KB Output is correct
89 Correct 146 ms 613300 KB Output is correct
90 Correct 146 ms 613212 KB Output is correct
91 Correct 143 ms 613128 KB Output is correct
92 Correct 147 ms 613204 KB Output is correct
93 Correct 148 ms 613200 KB Output is correct
94 Correct 145 ms 613308 KB Output is correct
95 Correct 144 ms 613200 KB Output is correct
96 Correct 146 ms 613112 KB Output is correct
97 Correct 144 ms 613104 KB Output is correct
98 Correct 142 ms 612976 KB Output is correct
99 Correct 145 ms 613204 KB Output is correct
100 Correct 148 ms 613456 KB Output is correct
101 Correct 150 ms 613112 KB Output is correct
102 Correct 148 ms 613156 KB Output is correct
103 Correct 146 ms 613056 KB Output is correct
104 Correct 144 ms 613204 KB Output is correct
105 Correct 146 ms 613044 KB Output is correct
106 Correct 146 ms 613208 KB Output is correct
107 Correct 146 ms 613444 KB Output is correct
108 Correct 148 ms 613060 KB Output is correct
109 Correct 151 ms 613200 KB Output is correct
110 Correct 167 ms 616788 KB Output is correct
111 Correct 167 ms 618340 KB Output is correct
112 Correct 169 ms 618832 KB Output is correct
113 Correct 166 ms 618844 KB Output is correct
114 Correct 165 ms 619000 KB Output is correct
115 Correct 163 ms 618580 KB Output is correct
116 Correct 168 ms 618880 KB Output is correct
117 Correct 172 ms 618792 KB Output is correct
118 Correct 176 ms 619084 KB Output is correct
119 Correct 203 ms 625072 KB Output is correct
120 Correct 207 ms 627792 KB Output is correct
121 Correct 208 ms 627772 KB Output is correct
122 Correct 196 ms 627248 KB Output is correct
123 Correct 189 ms 627276 KB Output is correct
124 Correct 394 ms 659504 KB Output is correct
125 Correct 989 ms 751768 KB Output is correct
126 Correct 1048 ms 776596 KB Output is correct
127 Correct 976 ms 776656 KB Output is correct
128 Correct 637 ms 764624 KB Output is correct
129 Correct 651 ms 764544 KB Output is correct
130 Correct 1123 ms 777112 KB Output is correct
131 Correct 1085 ms 777280 KB Output is correct
132 Correct 175 ms 618776 KB Output is correct
133 Correct 144 ms 613240 KB Output is correct
134 Correct 146 ms 613620 KB Output is correct
135 Correct 163 ms 616784 KB Output is correct
136 Correct 157 ms 617500 KB Output is correct
137 Correct 166 ms 618320 KB Output is correct
138 Correct 168 ms 619092 KB Output is correct
139 Correct 173 ms 618800 KB Output is correct
140 Correct 167 ms 618832 KB Output is correct
141 Correct 167 ms 618796 KB Output is correct
142 Correct 161 ms 618576 KB Output is correct
143 Correct 168 ms 618712 KB Output is correct
144 Correct 168 ms 618836 KB Output is correct
145 Correct 168 ms 618940 KB Output is correct
146 Correct 165 ms 618840 KB Output is correct
147 Correct 168 ms 618836 KB Output is correct
148 Correct 167 ms 618832 KB Output is correct
149 Correct 168 ms 618700 KB Output is correct
150 Correct 168 ms 618820 KB Output is correct
151 Correct 170 ms 618828 KB Output is correct
152 Correct 175 ms 618816 KB Output is correct
153 Correct 166 ms 618840 KB Output is correct
154 Correct 214 ms 627604 KB Output is correct
155 Correct 170 ms 618932 KB Output is correct
156 Correct 203 ms 624920 KB Output is correct
157 Correct 206 ms 626068 KB Output is correct
158 Correct 211 ms 628000 KB Output is correct
159 Correct 222 ms 627504 KB Output is correct
160 Correct 216 ms 627536 KB Output is correct
161 Correct 208 ms 627720 KB Output is correct
162 Correct 194 ms 627300 KB Output is correct
163 Correct 200 ms 627284 KB Output is correct
164 Correct 200 ms 627720 KB Output is correct
165 Correct 195 ms 627608 KB Output is correct
166 Correct 200 ms 627608 KB Output is correct
167 Correct 212 ms 627532 KB Output is correct
168 Correct 212 ms 627536 KB Output is correct
169 Correct 208 ms 627556 KB Output is correct
170 Correct 217 ms 627792 KB Output is correct
171 Correct 228 ms 627536 KB Output is correct
172 Correct 224 ms 627540 KB Output is correct
173 Correct 213 ms 627716 KB Output is correct
174 Correct 247 ms 632508 KB Output is correct
175 Correct 307 ms 647764 KB Output is correct
176 Correct 500 ms 694356 KB Output is correct
177 Correct 678 ms 720956 KB Output is correct
178 Correct 931 ms 754364 KB Output is correct
179 Correct 888 ms 775320 KB Output is correct
180 Correct 1034 ms 775460 KB Output is correct
181 Correct 1123 ms 775524 KB Output is correct
182 Correct 1246 ms 776508 KB Output is correct
183 Correct 1049 ms 775740 KB Output is correct
184 Execution timed out 2072 ms 940152 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 145 ms 613204 KB Output is correct
2 Correct 142 ms 613112 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 144 ms 613204 KB Output is correct
5 Correct 148 ms 613200 KB Output is correct
6 Correct 145 ms 613268 KB Output is correct
7 Correct 147 ms 613204 KB Output is correct
8 Correct 145 ms 613164 KB Output is correct
9 Correct 143 ms 613204 KB Output is correct
10 Correct 146 ms 612964 KB Output is correct
11 Correct 148 ms 613016 KB Output is correct
12 Correct 145 ms 613008 KB Output is correct
13 Correct 144 ms 613152 KB Output is correct
14 Correct 152 ms 613088 KB Output is correct
15 Correct 154 ms 613088 KB Output is correct
16 Correct 171 ms 613248 KB Output is correct
17 Correct 145 ms 613308 KB Output is correct
18 Correct 146 ms 613460 KB Output is correct
19 Correct 170 ms 618832 KB Output is correct
20 Correct 159 ms 617556 KB Output is correct
21 Correct 176 ms 619124 KB Output is correct
22 Correct 188 ms 618836 KB Output is correct
23 Correct 166 ms 618840 KB Output is correct
24 Correct 168 ms 618856 KB Output is correct
25 Correct 169 ms 618836 KB Output is correct
26 Correct 174 ms 618832 KB Output is correct
27 Correct 172 ms 618836 KB Output is correct
28 Correct 169 ms 618924 KB Output is correct
29 Correct 215 ms 627608 KB Output is correct
30 Correct 170 ms 618980 KB Output is correct
31 Correct 215 ms 627908 KB Output is correct
32 Correct 222 ms 627512 KB Output is correct
33 Correct 210 ms 627400 KB Output is correct
34 Correct 203 ms 627636 KB Output is correct
35 Correct 197 ms 627536 KB Output is correct
36 Correct 223 ms 627540 KB Output is correct
37 Correct 233 ms 627588 KB Output is correct
38 Correct 212 ms 627536 KB Output is correct
39 Correct 1063 ms 775384 KB Output is correct
40 Correct 228 ms 629840 KB Output is correct
41 Correct 213 ms 631228 KB Output is correct
42 Correct 249 ms 634508 KB Output is correct
43 Correct 257 ms 637472 KB Output is correct
44 Correct 561 ms 692180 KB Output is correct
45 Correct 550 ms 698964 KB Output is correct
46 Correct 1037 ms 776532 KB Output is correct
47 Correct 1091 ms 775116 KB Output is correct
48 Correct 1213 ms 775504 KB Output is correct
49 Correct 777 ms 775508 KB Output is correct
50 Correct 753 ms 776572 KB Output is correct
51 Correct 1268 ms 775616 KB Output is correct
52 Correct 1220 ms 775508 KB Output is correct
53 Correct 1202 ms 775496 KB Output is correct
54 Correct 144 ms 613048 KB Output is correct
55 Correct 147 ms 613212 KB Output is correct
56 Correct 149 ms 613260 KB Output is correct
57 Correct 146 ms 613204 KB Output is correct
58 Correct 149 ms 613064 KB Output is correct
59 Correct 147 ms 613204 KB Output is correct
60 Correct 147 ms 613204 KB Output is correct
61 Correct 143 ms 613200 KB Output is correct
62 Correct 143 ms 613204 KB Output is correct
63 Correct 145 ms 613284 KB Output is correct
64 Correct 147 ms 613204 KB Output is correct
65 Correct 144 ms 613244 KB Output is correct
66 Correct 145 ms 613204 KB Output is correct
67 Correct 145 ms 613200 KB Output is correct
68 Correct 145 ms 613076 KB Output is correct
69 Correct 147 ms 613304 KB Output is correct
70 Correct 146 ms 613200 KB Output is correct
71 Correct 145 ms 613348 KB Output is correct
72 Correct 144 ms 613292 KB Output is correct
73 Correct 146 ms 613008 KB Output is correct
74 Correct 143 ms 612996 KB Output is correct
75 Correct 144 ms 613368 KB Output is correct
76 Correct 144 ms 613200 KB Output is correct
77 Correct 144 ms 613208 KB Output is correct
78 Correct 142 ms 613204 KB Output is correct
79 Correct 147 ms 613204 KB Output is correct
80 Correct 144 ms 613020 KB Output is correct
81 Correct 148 ms 613136 KB Output is correct
82 Correct 147 ms 613456 KB Output is correct
83 Correct 144 ms 613200 KB Output is correct
84 Correct 144 ms 613232 KB Output is correct
85 Correct 144 ms 613180 KB Output is correct
86 Correct 143 ms 613200 KB Output is correct
87 Correct 146 ms 613020 KB Output is correct
88 Correct 141 ms 613208 KB Output is correct
89 Correct 146 ms 613300 KB Output is correct
90 Correct 146 ms 613212 KB Output is correct
91 Correct 143 ms 613128 KB Output is correct
92 Correct 147 ms 613204 KB Output is correct
93 Correct 148 ms 613200 KB Output is correct
94 Correct 145 ms 613308 KB Output is correct
95 Correct 144 ms 613200 KB Output is correct
96 Correct 146 ms 613112 KB Output is correct
97 Correct 144 ms 613104 KB Output is correct
98 Correct 142 ms 612976 KB Output is correct
99 Correct 145 ms 613204 KB Output is correct
100 Correct 148 ms 613456 KB Output is correct
101 Correct 150 ms 613112 KB Output is correct
102 Correct 148 ms 613156 KB Output is correct
103 Correct 146 ms 613056 KB Output is correct
104 Correct 144 ms 613204 KB Output is correct
105 Correct 146 ms 613044 KB Output is correct
106 Correct 146 ms 613208 KB Output is correct
107 Correct 146 ms 613444 KB Output is correct
108 Correct 148 ms 613060 KB Output is correct
109 Correct 151 ms 613200 KB Output is correct
110 Correct 167 ms 616788 KB Output is correct
111 Correct 167 ms 618340 KB Output is correct
112 Correct 169 ms 618832 KB Output is correct
113 Correct 166 ms 618844 KB Output is correct
114 Correct 165 ms 619000 KB Output is correct
115 Correct 163 ms 618580 KB Output is correct
116 Correct 168 ms 618880 KB Output is correct
117 Correct 172 ms 618792 KB Output is correct
118 Correct 176 ms 619084 KB Output is correct
119 Correct 203 ms 625072 KB Output is correct
120 Correct 207 ms 627792 KB Output is correct
121 Correct 208 ms 627772 KB Output is correct
122 Correct 196 ms 627248 KB Output is correct
123 Correct 189 ms 627276 KB Output is correct
124 Correct 394 ms 659504 KB Output is correct
125 Correct 989 ms 751768 KB Output is correct
126 Correct 1048 ms 776596 KB Output is correct
127 Correct 976 ms 776656 KB Output is correct
128 Correct 637 ms 764624 KB Output is correct
129 Correct 651 ms 764544 KB Output is correct
130 Correct 1123 ms 777112 KB Output is correct
131 Correct 1085 ms 777280 KB Output is correct
132 Correct 175 ms 618776 KB Output is correct
133 Correct 144 ms 613240 KB Output is correct
134 Correct 146 ms 613620 KB Output is correct
135 Correct 163 ms 616784 KB Output is correct
136 Correct 157 ms 617500 KB Output is correct
137 Correct 166 ms 618320 KB Output is correct
138 Correct 168 ms 619092 KB Output is correct
139 Correct 173 ms 618800 KB Output is correct
140 Correct 167 ms 618832 KB Output is correct
141 Correct 167 ms 618796 KB Output is correct
142 Correct 161 ms 618576 KB Output is correct
143 Correct 168 ms 618712 KB Output is correct
144 Correct 168 ms 618836 KB Output is correct
145 Correct 168 ms 618940 KB Output is correct
146 Correct 165 ms 618840 KB Output is correct
147 Correct 168 ms 618836 KB Output is correct
148 Correct 167 ms 618832 KB Output is correct
149 Correct 168 ms 618700 KB Output is correct
150 Correct 168 ms 618820 KB Output is correct
151 Correct 170 ms 618828 KB Output is correct
152 Correct 175 ms 618816 KB Output is correct
153 Correct 166 ms 618840 KB Output is correct
154 Correct 214 ms 627604 KB Output is correct
155 Correct 170 ms 618932 KB Output is correct
156 Correct 203 ms 624920 KB Output is correct
157 Correct 206 ms 626068 KB Output is correct
158 Correct 211 ms 628000 KB Output is correct
159 Correct 222 ms 627504 KB Output is correct
160 Correct 216 ms 627536 KB Output is correct
161 Correct 208 ms 627720 KB Output is correct
162 Correct 194 ms 627300 KB Output is correct
163 Correct 200 ms 627284 KB Output is correct
164 Correct 200 ms 627720 KB Output is correct
165 Correct 195 ms 627608 KB Output is correct
166 Correct 200 ms 627608 KB Output is correct
167 Correct 212 ms 627532 KB Output is correct
168 Correct 212 ms 627536 KB Output is correct
169 Correct 208 ms 627556 KB Output is correct
170 Correct 217 ms 627792 KB Output is correct
171 Correct 228 ms 627536 KB Output is correct
172 Correct 224 ms 627540 KB Output is correct
173 Correct 213 ms 627716 KB Output is correct
174 Correct 247 ms 632508 KB Output is correct
175 Correct 307 ms 647764 KB Output is correct
176 Correct 500 ms 694356 KB Output is correct
177 Correct 678 ms 720956 KB Output is correct
178 Correct 931 ms 754364 KB Output is correct
179 Correct 888 ms 775320 KB Output is correct
180 Correct 1034 ms 775460 KB Output is correct
181 Correct 1123 ms 775524 KB Output is correct
182 Correct 1246 ms 776508 KB Output is correct
183 Correct 1049 ms 775740 KB Output is correct
184 Execution timed out 2072 ms 940152 KB Time limit exceeded
185 Halted 0 ms 0 KB -