Submission #924166

# Submission time Handle Problem Language Result Execution time Memory
924166 2024-02-08T15:35:47 Z vjudge1 Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 940764 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 226 ms 613204 KB Output is correct
2 Correct 146 ms 613204 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 155 ms 613296 KB Output is correct
5 Correct 144 ms 613204 KB Output is correct
6 Correct 143 ms 613204 KB Output is correct
7 Correct 143 ms 613200 KB Output is correct
8 Correct 146 ms 613204 KB Output is correct
9 Correct 144 ms 613200 KB Output is correct
10 Correct 148 ms 613460 KB Output is correct
11 Correct 147 ms 613356 KB Output is correct
12 Correct 145 ms 613108 KB Output is correct
13 Correct 144 ms 613200 KB Output is correct
14 Correct 147 ms 613200 KB Output is correct
15 Correct 144 ms 613100 KB Output is correct
16 Correct 143 ms 613204 KB Output is correct
17 Correct 146 ms 613204 KB Output is correct
18 Correct 144 ms 613180 KB Output is correct
19 Correct 171 ms 618764 KB Output is correct
20 Correct 159 ms 617328 KB Output is correct
21 Correct 169 ms 619084 KB Output is correct
22 Correct 171 ms 618688 KB Output is correct
23 Correct 168 ms 618836 KB Output is correct
24 Correct 166 ms 619092 KB Output is correct
25 Correct 174 ms 618832 KB Output is correct
26 Correct 176 ms 618700 KB Output is correct
27 Correct 173 ms 618832 KB Output is correct
28 Correct 168 ms 618836 KB Output is correct
29 Correct 211 ms 627588 KB Output is correct
30 Correct 168 ms 618896 KB Output is correct
31 Correct 208 ms 627792 KB Output is correct
32 Correct 221 ms 627584 KB Output is correct
33 Correct 227 ms 627576 KB Output is correct
34 Correct 196 ms 627632 KB Output is correct
35 Correct 196 ms 627540 KB Output is correct
36 Correct 232 ms 627792 KB Output is correct
37 Correct 230 ms 627536 KB Output is correct
38 Correct 242 ms 627616 KB Output is correct
39 Correct 1058 ms 775144 KB Output is correct
40 Correct 225 ms 629580 KB Output is correct
41 Correct 209 ms 631120 KB Output is correct
42 Correct 259 ms 634452 KB Output is correct
43 Correct 248 ms 637644 KB Output is correct
44 Correct 567 ms 692472 KB Output is correct
45 Correct 546 ms 698828 KB Output is correct
46 Correct 1073 ms 777504 KB Output is correct
47 Correct 1099 ms 775328 KB Output is correct
48 Correct 1215 ms 775300 KB Output is correct
49 Correct 785 ms 775568 KB Output is correct
50 Correct 756 ms 775432 KB Output is correct
51 Correct 1256 ms 775348 KB Output is correct
52 Correct 1284 ms 776388 KB Output is correct
53 Correct 1185 ms 775476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 613368 KB Output is correct
2 Correct 144 ms 613200 KB Output is correct
3 Correct 144 ms 613344 KB Output is correct
4 Correct 143 ms 613040 KB Output is correct
5 Correct 148 ms 613304 KB Output is correct
6 Correct 144 ms 613204 KB Output is correct
7 Correct 144 ms 613024 KB Output is correct
8 Correct 145 ms 613168 KB Output is correct
9 Correct 145 ms 613200 KB Output is correct
10 Correct 145 ms 613052 KB Output is correct
11 Correct 145 ms 613204 KB Output is correct
12 Correct 144 ms 613192 KB Output is correct
13 Correct 144 ms 613100 KB Output is correct
14 Correct 146 ms 613204 KB Output is correct
15 Correct 144 ms 613200 KB Output is correct
16 Correct 149 ms 613156 KB Output is correct
17 Correct 145 ms 613200 KB Output is correct
18 Correct 144 ms 613188 KB Output is correct
19 Correct 161 ms 613140 KB Output is correct
20 Correct 144 ms 613056 KB Output is correct
21 Correct 145 ms 613084 KB Output is correct
22 Correct 146 ms 613100 KB Output is correct
23 Correct 151 ms 613176 KB Output is correct
24 Correct 143 ms 613200 KB Output is correct
25 Correct 147 ms 613204 KB Output is correct
26 Correct 143 ms 613208 KB Output is correct
27 Correct 145 ms 613164 KB Output is correct
28 Correct 146 ms 613084 KB Output is correct
29 Correct 147 ms 613200 KB Output is correct
30 Correct 148 ms 613148 KB Output is correct
31 Correct 146 ms 613204 KB Output is correct
32 Correct 146 ms 613204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 612996 KB Output is correct
2 Correct 146 ms 613208 KB Output is correct
3 Correct 144 ms 612968 KB Output is correct
4 Correct 142 ms 612988 KB Output is correct
5 Correct 142 ms 613140 KB Output is correct
6 Correct 146 ms 613204 KB Output is correct
7 Correct 150 ms 613204 KB Output is correct
8 Correct 142 ms 613196 KB Output is correct
9 Correct 149 ms 613424 KB Output is correct
10 Correct 141 ms 613200 KB Output is correct
11 Correct 145 ms 613156 KB Output is correct
12 Correct 147 ms 613092 KB Output is correct
13 Correct 143 ms 613200 KB Output is correct
14 Correct 144 ms 613156 KB Output is correct
15 Correct 144 ms 613200 KB Output is correct
16 Correct 142 ms 613208 KB Output is correct
17 Correct 145 ms 612988 KB Output is correct
18 Correct 143 ms 613204 KB Output is correct
19 Correct 143 ms 613052 KB Output is correct
20 Correct 147 ms 613004 KB Output is correct
21 Correct 143 ms 613136 KB Output is correct
22 Correct 143 ms 613204 KB Output is correct
23 Correct 146 ms 613200 KB Output is correct
24 Correct 144 ms 613188 KB Output is correct
25 Correct 162 ms 616788 KB Output is correct
26 Correct 168 ms 618324 KB Output is correct
27 Correct 169 ms 619052 KB Output is correct
28 Correct 171 ms 618936 KB Output is correct
29 Correct 167 ms 618828 KB Output is correct
30 Correct 170 ms 618944 KB Output is correct
31 Correct 171 ms 618884 KB Output is correct
32 Correct 170 ms 618832 KB Output is correct
33 Correct 175 ms 618844 KB Output is correct
34 Correct 203 ms 624976 KB Output is correct
35 Correct 208 ms 627636 KB Output is correct
36 Correct 206 ms 627796 KB Output is correct
37 Correct 195 ms 627240 KB Output is correct
38 Correct 196 ms 627184 KB Output is correct
39 Correct 392 ms 659560 KB Output is correct
40 Correct 1014 ms 751508 KB Output is correct
41 Correct 1079 ms 777692 KB Output is correct
42 Correct 989 ms 776784 KB Output is correct
43 Correct 649 ms 764708 KB Output is correct
44 Correct 641 ms 764560 KB Output is correct
45 Correct 1100 ms 777276 KB Output is correct
46 Correct 1101 ms 777184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 613368 KB Output is correct
2 Correct 144 ms 613200 KB Output is correct
3 Correct 144 ms 613344 KB Output is correct
4 Correct 143 ms 613040 KB Output is correct
5 Correct 148 ms 613304 KB Output is correct
6 Correct 144 ms 613204 KB Output is correct
7 Correct 144 ms 613024 KB Output is correct
8 Correct 145 ms 613168 KB Output is correct
9 Correct 145 ms 613200 KB Output is correct
10 Correct 145 ms 613052 KB Output is correct
11 Correct 145 ms 613204 KB Output is correct
12 Correct 144 ms 613192 KB Output is correct
13 Correct 144 ms 613100 KB Output is correct
14 Correct 146 ms 613204 KB Output is correct
15 Correct 144 ms 613200 KB Output is correct
16 Correct 149 ms 613156 KB Output is correct
17 Correct 145 ms 613200 KB Output is correct
18 Correct 144 ms 613188 KB Output is correct
19 Correct 161 ms 613140 KB Output is correct
20 Correct 144 ms 613056 KB Output is correct
21 Correct 145 ms 613084 KB Output is correct
22 Correct 146 ms 613100 KB Output is correct
23 Correct 151 ms 613176 KB Output is correct
24 Correct 143 ms 613200 KB Output is correct
25 Correct 147 ms 613204 KB Output is correct
26 Correct 143 ms 613208 KB Output is correct
27 Correct 145 ms 613164 KB Output is correct
28 Correct 146 ms 613084 KB Output is correct
29 Correct 147 ms 613200 KB Output is correct
30 Correct 148 ms 613148 KB Output is correct
31 Correct 146 ms 613204 KB Output is correct
32 Correct 146 ms 613204 KB Output is correct
33 Correct 171 ms 618832 KB Output is correct
34 Correct 144 ms 613200 KB Output is correct
35 Correct 144 ms 613440 KB Output is correct
36 Correct 160 ms 616788 KB Output is correct
37 Correct 159 ms 617340 KB Output is correct
38 Correct 171 ms 618292 KB Output is correct
39 Correct 168 ms 618836 KB Output is correct
40 Correct 180 ms 618836 KB Output is correct
41 Correct 166 ms 618748 KB Output is correct
42 Correct 166 ms 618800 KB Output is correct
43 Correct 161 ms 618580 KB Output is correct
44 Correct 162 ms 618736 KB Output is correct
45 Correct 167 ms 618836 KB Output is correct
46 Correct 164 ms 618836 KB Output is correct
47 Correct 163 ms 618832 KB Output is correct
48 Correct 165 ms 618836 KB Output is correct
49 Correct 166 ms 618748 KB Output is correct
50 Correct 171 ms 618836 KB Output is correct
51 Correct 167 ms 618688 KB Output is correct
52 Correct 171 ms 618836 KB Output is correct
53 Correct 173 ms 618712 KB Output is correct
54 Correct 172 ms 618804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 613368 KB Output is correct
2 Correct 144 ms 613200 KB Output is correct
3 Correct 144 ms 613344 KB Output is correct
4 Correct 143 ms 613040 KB Output is correct
5 Correct 148 ms 613304 KB Output is correct
6 Correct 144 ms 613204 KB Output is correct
7 Correct 144 ms 613024 KB Output is correct
8 Correct 145 ms 613168 KB Output is correct
9 Correct 145 ms 613200 KB Output is correct
10 Correct 145 ms 613052 KB Output is correct
11 Correct 145 ms 613204 KB Output is correct
12 Correct 144 ms 613192 KB Output is correct
13 Correct 144 ms 613100 KB Output is correct
14 Correct 146 ms 613204 KB Output is correct
15 Correct 144 ms 613200 KB Output is correct
16 Correct 149 ms 613156 KB Output is correct
17 Correct 145 ms 613200 KB Output is correct
18 Correct 144 ms 613188 KB Output is correct
19 Correct 161 ms 613140 KB Output is correct
20 Correct 144 ms 613056 KB Output is correct
21 Correct 145 ms 613084 KB Output is correct
22 Correct 146 ms 613100 KB Output is correct
23 Correct 151 ms 613176 KB Output is correct
24 Correct 143 ms 613200 KB Output is correct
25 Correct 147 ms 613204 KB Output is correct
26 Correct 143 ms 613208 KB Output is correct
27 Correct 145 ms 613164 KB Output is correct
28 Correct 146 ms 613084 KB Output is correct
29 Correct 147 ms 613200 KB Output is correct
30 Correct 148 ms 613148 KB Output is correct
31 Correct 146 ms 613204 KB Output is correct
32 Correct 146 ms 613204 KB Output is correct
33 Correct 171 ms 618832 KB Output is correct
34 Correct 144 ms 613200 KB Output is correct
35 Correct 144 ms 613440 KB Output is correct
36 Correct 160 ms 616788 KB Output is correct
37 Correct 159 ms 617340 KB Output is correct
38 Correct 171 ms 618292 KB Output is correct
39 Correct 168 ms 618836 KB Output is correct
40 Correct 180 ms 618836 KB Output is correct
41 Correct 166 ms 618748 KB Output is correct
42 Correct 166 ms 618800 KB Output is correct
43 Correct 161 ms 618580 KB Output is correct
44 Correct 162 ms 618736 KB Output is correct
45 Correct 167 ms 618836 KB Output is correct
46 Correct 164 ms 618836 KB Output is correct
47 Correct 163 ms 618832 KB Output is correct
48 Correct 165 ms 618836 KB Output is correct
49 Correct 166 ms 618748 KB Output is correct
50 Correct 171 ms 618836 KB Output is correct
51 Correct 167 ms 618688 KB Output is correct
52 Correct 171 ms 618836 KB Output is correct
53 Correct 173 ms 618712 KB Output is correct
54 Correct 172 ms 618804 KB Output is correct
55 Correct 208 ms 627692 KB Output is correct
56 Correct 170 ms 618836 KB Output is correct
57 Correct 204 ms 625236 KB Output is correct
58 Correct 204 ms 626260 KB Output is correct
59 Correct 208 ms 627796 KB Output is correct
60 Correct 233 ms 627840 KB Output is correct
61 Correct 218 ms 627536 KB Output is correct
62 Correct 218 ms 627792 KB Output is correct
63 Correct 250 ms 627540 KB Output is correct
64 Correct 191 ms 627092 KB Output is correct
65 Correct 196 ms 627388 KB Output is correct
66 Correct 201 ms 627796 KB Output is correct
67 Correct 199 ms 627396 KB Output is correct
68 Correct 204 ms 627536 KB Output is correct
69 Correct 216 ms 627796 KB Output is correct
70 Correct 215 ms 627536 KB Output is correct
71 Correct 210 ms 627488 KB Output is correct
72 Correct 238 ms 627792 KB Output is correct
73 Correct 231 ms 627604 KB Output is correct
74 Correct 214 ms 627536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 226 ms 613204 KB Output is correct
2 Correct 146 ms 613204 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 155 ms 613296 KB Output is correct
5 Correct 144 ms 613204 KB Output is correct
6 Correct 143 ms 613204 KB Output is correct
7 Correct 143 ms 613200 KB Output is correct
8 Correct 146 ms 613204 KB Output is correct
9 Correct 144 ms 613200 KB Output is correct
10 Correct 148 ms 613460 KB Output is correct
11 Correct 147 ms 613356 KB Output is correct
12 Correct 145 ms 613108 KB Output is correct
13 Correct 144 ms 613200 KB Output is correct
14 Correct 147 ms 613200 KB Output is correct
15 Correct 144 ms 613100 KB Output is correct
16 Correct 143 ms 613204 KB Output is correct
17 Correct 146 ms 613204 KB Output is correct
18 Correct 144 ms 613180 KB Output is correct
19 Correct 171 ms 618764 KB Output is correct
20 Correct 159 ms 617328 KB Output is correct
21 Correct 169 ms 619084 KB Output is correct
22 Correct 171 ms 618688 KB Output is correct
23 Correct 168 ms 618836 KB Output is correct
24 Correct 166 ms 619092 KB Output is correct
25 Correct 174 ms 618832 KB Output is correct
26 Correct 176 ms 618700 KB Output is correct
27 Correct 173 ms 618832 KB Output is correct
28 Correct 168 ms 618836 KB Output is correct
29 Correct 211 ms 627588 KB Output is correct
30 Correct 168 ms 618896 KB Output is correct
31 Correct 208 ms 627792 KB Output is correct
32 Correct 221 ms 627584 KB Output is correct
33 Correct 227 ms 627576 KB Output is correct
34 Correct 196 ms 627632 KB Output is correct
35 Correct 196 ms 627540 KB Output is correct
36 Correct 232 ms 627792 KB Output is correct
37 Correct 230 ms 627536 KB Output is correct
38 Correct 242 ms 627616 KB Output is correct
39 Correct 1058 ms 775144 KB Output is correct
40 Correct 225 ms 629580 KB Output is correct
41 Correct 209 ms 631120 KB Output is correct
42 Correct 259 ms 634452 KB Output is correct
43 Correct 248 ms 637644 KB Output is correct
44 Correct 567 ms 692472 KB Output is correct
45 Correct 546 ms 698828 KB Output is correct
46 Correct 1073 ms 777504 KB Output is correct
47 Correct 1099 ms 775328 KB Output is correct
48 Correct 1215 ms 775300 KB Output is correct
49 Correct 785 ms 775568 KB Output is correct
50 Correct 756 ms 775432 KB Output is correct
51 Correct 1256 ms 775348 KB Output is correct
52 Correct 1284 ms 776388 KB Output is correct
53 Correct 1185 ms 775476 KB Output is correct
54 Correct 144 ms 613368 KB Output is correct
55 Correct 144 ms 613200 KB Output is correct
56 Correct 144 ms 613344 KB Output is correct
57 Correct 143 ms 613040 KB Output is correct
58 Correct 148 ms 613304 KB Output is correct
59 Correct 144 ms 613204 KB Output is correct
60 Correct 144 ms 613024 KB Output is correct
61 Correct 145 ms 613168 KB Output is correct
62 Correct 145 ms 613200 KB Output is correct
63 Correct 145 ms 613052 KB Output is correct
64 Correct 145 ms 613204 KB Output is correct
65 Correct 144 ms 613192 KB Output is correct
66 Correct 144 ms 613100 KB Output is correct
67 Correct 146 ms 613204 KB Output is correct
68 Correct 144 ms 613200 KB Output is correct
69 Correct 149 ms 613156 KB Output is correct
70 Correct 145 ms 613200 KB Output is correct
71 Correct 144 ms 613188 KB Output is correct
72 Correct 161 ms 613140 KB Output is correct
73 Correct 144 ms 613056 KB Output is correct
74 Correct 145 ms 613084 KB Output is correct
75 Correct 146 ms 613100 KB Output is correct
76 Correct 151 ms 613176 KB Output is correct
77 Correct 143 ms 613200 KB Output is correct
78 Correct 147 ms 613204 KB Output is correct
79 Correct 143 ms 613208 KB Output is correct
80 Correct 145 ms 613164 KB Output is correct
81 Correct 146 ms 613084 KB Output is correct
82 Correct 147 ms 613200 KB Output is correct
83 Correct 148 ms 613148 KB Output is correct
84 Correct 146 ms 613204 KB Output is correct
85 Correct 146 ms 613204 KB Output is correct
86 Correct 144 ms 612996 KB Output is correct
87 Correct 146 ms 613208 KB Output is correct
88 Correct 144 ms 612968 KB Output is correct
89 Correct 142 ms 612988 KB Output is correct
90 Correct 142 ms 613140 KB Output is correct
91 Correct 146 ms 613204 KB Output is correct
92 Correct 150 ms 613204 KB Output is correct
93 Correct 142 ms 613196 KB Output is correct
94 Correct 149 ms 613424 KB Output is correct
95 Correct 141 ms 613200 KB Output is correct
96 Correct 145 ms 613156 KB Output is correct
97 Correct 147 ms 613092 KB Output is correct
98 Correct 143 ms 613200 KB Output is correct
99 Correct 144 ms 613156 KB Output is correct
100 Correct 144 ms 613200 KB Output is correct
101 Correct 142 ms 613208 KB Output is correct
102 Correct 145 ms 612988 KB Output is correct
103 Correct 143 ms 613204 KB Output is correct
104 Correct 143 ms 613052 KB Output is correct
105 Correct 147 ms 613004 KB Output is correct
106 Correct 143 ms 613136 KB Output is correct
107 Correct 143 ms 613204 KB Output is correct
108 Correct 146 ms 613200 KB Output is correct
109 Correct 144 ms 613188 KB Output is correct
110 Correct 162 ms 616788 KB Output is correct
111 Correct 168 ms 618324 KB Output is correct
112 Correct 169 ms 619052 KB Output is correct
113 Correct 171 ms 618936 KB Output is correct
114 Correct 167 ms 618828 KB Output is correct
115 Correct 170 ms 618944 KB Output is correct
116 Correct 171 ms 618884 KB Output is correct
117 Correct 170 ms 618832 KB Output is correct
118 Correct 175 ms 618844 KB Output is correct
119 Correct 203 ms 624976 KB Output is correct
120 Correct 208 ms 627636 KB Output is correct
121 Correct 206 ms 627796 KB Output is correct
122 Correct 195 ms 627240 KB Output is correct
123 Correct 196 ms 627184 KB Output is correct
124 Correct 392 ms 659560 KB Output is correct
125 Correct 1014 ms 751508 KB Output is correct
126 Correct 1079 ms 777692 KB Output is correct
127 Correct 989 ms 776784 KB Output is correct
128 Correct 649 ms 764708 KB Output is correct
129 Correct 641 ms 764560 KB Output is correct
130 Correct 1100 ms 777276 KB Output is correct
131 Correct 1101 ms 777184 KB Output is correct
132 Correct 171 ms 618832 KB Output is correct
133 Correct 144 ms 613200 KB Output is correct
134 Correct 144 ms 613440 KB Output is correct
135 Correct 160 ms 616788 KB Output is correct
136 Correct 159 ms 617340 KB Output is correct
137 Correct 171 ms 618292 KB Output is correct
138 Correct 168 ms 618836 KB Output is correct
139 Correct 180 ms 618836 KB Output is correct
140 Correct 166 ms 618748 KB Output is correct
141 Correct 166 ms 618800 KB Output is correct
142 Correct 161 ms 618580 KB Output is correct
143 Correct 162 ms 618736 KB Output is correct
144 Correct 167 ms 618836 KB Output is correct
145 Correct 164 ms 618836 KB Output is correct
146 Correct 163 ms 618832 KB Output is correct
147 Correct 165 ms 618836 KB Output is correct
148 Correct 166 ms 618748 KB Output is correct
149 Correct 171 ms 618836 KB Output is correct
150 Correct 167 ms 618688 KB Output is correct
151 Correct 171 ms 618836 KB Output is correct
152 Correct 173 ms 618712 KB Output is correct
153 Correct 172 ms 618804 KB Output is correct
154 Correct 208 ms 627692 KB Output is correct
155 Correct 170 ms 618836 KB Output is correct
156 Correct 204 ms 625236 KB Output is correct
157 Correct 204 ms 626260 KB Output is correct
158 Correct 208 ms 627796 KB Output is correct
159 Correct 233 ms 627840 KB Output is correct
160 Correct 218 ms 627536 KB Output is correct
161 Correct 218 ms 627792 KB Output is correct
162 Correct 250 ms 627540 KB Output is correct
163 Correct 191 ms 627092 KB Output is correct
164 Correct 196 ms 627388 KB Output is correct
165 Correct 201 ms 627796 KB Output is correct
166 Correct 199 ms 627396 KB Output is correct
167 Correct 204 ms 627536 KB Output is correct
168 Correct 216 ms 627796 KB Output is correct
169 Correct 215 ms 627536 KB Output is correct
170 Correct 210 ms 627488 KB Output is correct
171 Correct 238 ms 627792 KB Output is correct
172 Correct 231 ms 627604 KB Output is correct
173 Correct 214 ms 627536 KB Output is correct
174 Correct 241 ms 632312 KB Output is correct
175 Correct 304 ms 647760 KB Output is correct
176 Correct 498 ms 694440 KB Output is correct
177 Correct 734 ms 720980 KB Output is correct
178 Correct 936 ms 754456 KB Output is correct
179 Correct 899 ms 775660 KB Output is correct
180 Correct 1033 ms 775252 KB Output is correct
181 Correct 1082 ms 775460 KB Output is correct
182 Correct 1107 ms 775592 KB Output is correct
183 Correct 1034 ms 775480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 226 ms 613204 KB Output is correct
2 Correct 146 ms 613204 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 155 ms 613296 KB Output is correct
5 Correct 144 ms 613204 KB Output is correct
6 Correct 143 ms 613204 KB Output is correct
7 Correct 143 ms 613200 KB Output is correct
8 Correct 146 ms 613204 KB Output is correct
9 Correct 144 ms 613200 KB Output is correct
10 Correct 148 ms 613460 KB Output is correct
11 Correct 147 ms 613356 KB Output is correct
12 Correct 145 ms 613108 KB Output is correct
13 Correct 144 ms 613200 KB Output is correct
14 Correct 147 ms 613200 KB Output is correct
15 Correct 144 ms 613100 KB Output is correct
16 Correct 143 ms 613204 KB Output is correct
17 Correct 146 ms 613204 KB Output is correct
18 Correct 144 ms 613180 KB Output is correct
19 Correct 171 ms 618764 KB Output is correct
20 Correct 159 ms 617328 KB Output is correct
21 Correct 169 ms 619084 KB Output is correct
22 Correct 171 ms 618688 KB Output is correct
23 Correct 168 ms 618836 KB Output is correct
24 Correct 166 ms 619092 KB Output is correct
25 Correct 174 ms 618832 KB Output is correct
26 Correct 176 ms 618700 KB Output is correct
27 Correct 173 ms 618832 KB Output is correct
28 Correct 168 ms 618836 KB Output is correct
29 Correct 211 ms 627588 KB Output is correct
30 Correct 168 ms 618896 KB Output is correct
31 Correct 208 ms 627792 KB Output is correct
32 Correct 221 ms 627584 KB Output is correct
33 Correct 227 ms 627576 KB Output is correct
34 Correct 196 ms 627632 KB Output is correct
35 Correct 196 ms 627540 KB Output is correct
36 Correct 232 ms 627792 KB Output is correct
37 Correct 230 ms 627536 KB Output is correct
38 Correct 242 ms 627616 KB Output is correct
39 Correct 1058 ms 775144 KB Output is correct
40 Correct 225 ms 629580 KB Output is correct
41 Correct 209 ms 631120 KB Output is correct
42 Correct 259 ms 634452 KB Output is correct
43 Correct 248 ms 637644 KB Output is correct
44 Correct 567 ms 692472 KB Output is correct
45 Correct 546 ms 698828 KB Output is correct
46 Correct 1073 ms 777504 KB Output is correct
47 Correct 1099 ms 775328 KB Output is correct
48 Correct 1215 ms 775300 KB Output is correct
49 Correct 785 ms 775568 KB Output is correct
50 Correct 756 ms 775432 KB Output is correct
51 Correct 1256 ms 775348 KB Output is correct
52 Correct 1284 ms 776388 KB Output is correct
53 Correct 1185 ms 775476 KB Output is correct
54 Correct 144 ms 613368 KB Output is correct
55 Correct 144 ms 613200 KB Output is correct
56 Correct 144 ms 613344 KB Output is correct
57 Correct 143 ms 613040 KB Output is correct
58 Correct 148 ms 613304 KB Output is correct
59 Correct 144 ms 613204 KB Output is correct
60 Correct 144 ms 613024 KB Output is correct
61 Correct 145 ms 613168 KB Output is correct
62 Correct 145 ms 613200 KB Output is correct
63 Correct 145 ms 613052 KB Output is correct
64 Correct 145 ms 613204 KB Output is correct
65 Correct 144 ms 613192 KB Output is correct
66 Correct 144 ms 613100 KB Output is correct
67 Correct 146 ms 613204 KB Output is correct
68 Correct 144 ms 613200 KB Output is correct
69 Correct 149 ms 613156 KB Output is correct
70 Correct 145 ms 613200 KB Output is correct
71 Correct 144 ms 613188 KB Output is correct
72 Correct 161 ms 613140 KB Output is correct
73 Correct 144 ms 613056 KB Output is correct
74 Correct 145 ms 613084 KB Output is correct
75 Correct 146 ms 613100 KB Output is correct
76 Correct 151 ms 613176 KB Output is correct
77 Correct 143 ms 613200 KB Output is correct
78 Correct 147 ms 613204 KB Output is correct
79 Correct 143 ms 613208 KB Output is correct
80 Correct 145 ms 613164 KB Output is correct
81 Correct 146 ms 613084 KB Output is correct
82 Correct 147 ms 613200 KB Output is correct
83 Correct 148 ms 613148 KB Output is correct
84 Correct 146 ms 613204 KB Output is correct
85 Correct 146 ms 613204 KB Output is correct
86 Correct 144 ms 612996 KB Output is correct
87 Correct 146 ms 613208 KB Output is correct
88 Correct 144 ms 612968 KB Output is correct
89 Correct 142 ms 612988 KB Output is correct
90 Correct 142 ms 613140 KB Output is correct
91 Correct 146 ms 613204 KB Output is correct
92 Correct 150 ms 613204 KB Output is correct
93 Correct 142 ms 613196 KB Output is correct
94 Correct 149 ms 613424 KB Output is correct
95 Correct 141 ms 613200 KB Output is correct
96 Correct 145 ms 613156 KB Output is correct
97 Correct 147 ms 613092 KB Output is correct
98 Correct 143 ms 613200 KB Output is correct
99 Correct 144 ms 613156 KB Output is correct
100 Correct 144 ms 613200 KB Output is correct
101 Correct 142 ms 613208 KB Output is correct
102 Correct 145 ms 612988 KB Output is correct
103 Correct 143 ms 613204 KB Output is correct
104 Correct 143 ms 613052 KB Output is correct
105 Correct 147 ms 613004 KB Output is correct
106 Correct 143 ms 613136 KB Output is correct
107 Correct 143 ms 613204 KB Output is correct
108 Correct 146 ms 613200 KB Output is correct
109 Correct 144 ms 613188 KB Output is correct
110 Correct 162 ms 616788 KB Output is correct
111 Correct 168 ms 618324 KB Output is correct
112 Correct 169 ms 619052 KB Output is correct
113 Correct 171 ms 618936 KB Output is correct
114 Correct 167 ms 618828 KB Output is correct
115 Correct 170 ms 618944 KB Output is correct
116 Correct 171 ms 618884 KB Output is correct
117 Correct 170 ms 618832 KB Output is correct
118 Correct 175 ms 618844 KB Output is correct
119 Correct 203 ms 624976 KB Output is correct
120 Correct 208 ms 627636 KB Output is correct
121 Correct 206 ms 627796 KB Output is correct
122 Correct 195 ms 627240 KB Output is correct
123 Correct 196 ms 627184 KB Output is correct
124 Correct 392 ms 659560 KB Output is correct
125 Correct 1014 ms 751508 KB Output is correct
126 Correct 1079 ms 777692 KB Output is correct
127 Correct 989 ms 776784 KB Output is correct
128 Correct 649 ms 764708 KB Output is correct
129 Correct 641 ms 764560 KB Output is correct
130 Correct 1100 ms 777276 KB Output is correct
131 Correct 1101 ms 777184 KB Output is correct
132 Correct 171 ms 618832 KB Output is correct
133 Correct 144 ms 613200 KB Output is correct
134 Correct 144 ms 613440 KB Output is correct
135 Correct 160 ms 616788 KB Output is correct
136 Correct 159 ms 617340 KB Output is correct
137 Correct 171 ms 618292 KB Output is correct
138 Correct 168 ms 618836 KB Output is correct
139 Correct 180 ms 618836 KB Output is correct
140 Correct 166 ms 618748 KB Output is correct
141 Correct 166 ms 618800 KB Output is correct
142 Correct 161 ms 618580 KB Output is correct
143 Correct 162 ms 618736 KB Output is correct
144 Correct 167 ms 618836 KB Output is correct
145 Correct 164 ms 618836 KB Output is correct
146 Correct 163 ms 618832 KB Output is correct
147 Correct 165 ms 618836 KB Output is correct
148 Correct 166 ms 618748 KB Output is correct
149 Correct 171 ms 618836 KB Output is correct
150 Correct 167 ms 618688 KB Output is correct
151 Correct 171 ms 618836 KB Output is correct
152 Correct 173 ms 618712 KB Output is correct
153 Correct 172 ms 618804 KB Output is correct
154 Correct 208 ms 627692 KB Output is correct
155 Correct 170 ms 618836 KB Output is correct
156 Correct 204 ms 625236 KB Output is correct
157 Correct 204 ms 626260 KB Output is correct
158 Correct 208 ms 627796 KB Output is correct
159 Correct 233 ms 627840 KB Output is correct
160 Correct 218 ms 627536 KB Output is correct
161 Correct 218 ms 627792 KB Output is correct
162 Correct 250 ms 627540 KB Output is correct
163 Correct 191 ms 627092 KB Output is correct
164 Correct 196 ms 627388 KB Output is correct
165 Correct 201 ms 627796 KB Output is correct
166 Correct 199 ms 627396 KB Output is correct
167 Correct 204 ms 627536 KB Output is correct
168 Correct 216 ms 627796 KB Output is correct
169 Correct 215 ms 627536 KB Output is correct
170 Correct 210 ms 627488 KB Output is correct
171 Correct 238 ms 627792 KB Output is correct
172 Correct 231 ms 627604 KB Output is correct
173 Correct 214 ms 627536 KB Output is correct
174 Correct 241 ms 632312 KB Output is correct
175 Correct 304 ms 647760 KB Output is correct
176 Correct 498 ms 694440 KB Output is correct
177 Correct 734 ms 720980 KB Output is correct
178 Correct 936 ms 754456 KB Output is correct
179 Correct 899 ms 775660 KB Output is correct
180 Correct 1033 ms 775252 KB Output is correct
181 Correct 1082 ms 775460 KB Output is correct
182 Correct 1107 ms 775592 KB Output is correct
183 Correct 1034 ms 775480 KB Output is correct
184 Execution timed out 2045 ms 940764 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 226 ms 613204 KB Output is correct
2 Correct 146 ms 613204 KB Output is correct
3 Correct 145 ms 613204 KB Output is correct
4 Correct 155 ms 613296 KB Output is correct
5 Correct 144 ms 613204 KB Output is correct
6 Correct 143 ms 613204 KB Output is correct
7 Correct 143 ms 613200 KB Output is correct
8 Correct 146 ms 613204 KB Output is correct
9 Correct 144 ms 613200 KB Output is correct
10 Correct 148 ms 613460 KB Output is correct
11 Correct 147 ms 613356 KB Output is correct
12 Correct 145 ms 613108 KB Output is correct
13 Correct 144 ms 613200 KB Output is correct
14 Correct 147 ms 613200 KB Output is correct
15 Correct 144 ms 613100 KB Output is correct
16 Correct 143 ms 613204 KB Output is correct
17 Correct 146 ms 613204 KB Output is correct
18 Correct 144 ms 613180 KB Output is correct
19 Correct 171 ms 618764 KB Output is correct
20 Correct 159 ms 617328 KB Output is correct
21 Correct 169 ms 619084 KB Output is correct
22 Correct 171 ms 618688 KB Output is correct
23 Correct 168 ms 618836 KB Output is correct
24 Correct 166 ms 619092 KB Output is correct
25 Correct 174 ms 618832 KB Output is correct
26 Correct 176 ms 618700 KB Output is correct
27 Correct 173 ms 618832 KB Output is correct
28 Correct 168 ms 618836 KB Output is correct
29 Correct 211 ms 627588 KB Output is correct
30 Correct 168 ms 618896 KB Output is correct
31 Correct 208 ms 627792 KB Output is correct
32 Correct 221 ms 627584 KB Output is correct
33 Correct 227 ms 627576 KB Output is correct
34 Correct 196 ms 627632 KB Output is correct
35 Correct 196 ms 627540 KB Output is correct
36 Correct 232 ms 627792 KB Output is correct
37 Correct 230 ms 627536 KB Output is correct
38 Correct 242 ms 627616 KB Output is correct
39 Correct 1058 ms 775144 KB Output is correct
40 Correct 225 ms 629580 KB Output is correct
41 Correct 209 ms 631120 KB Output is correct
42 Correct 259 ms 634452 KB Output is correct
43 Correct 248 ms 637644 KB Output is correct
44 Correct 567 ms 692472 KB Output is correct
45 Correct 546 ms 698828 KB Output is correct
46 Correct 1073 ms 777504 KB Output is correct
47 Correct 1099 ms 775328 KB Output is correct
48 Correct 1215 ms 775300 KB Output is correct
49 Correct 785 ms 775568 KB Output is correct
50 Correct 756 ms 775432 KB Output is correct
51 Correct 1256 ms 775348 KB Output is correct
52 Correct 1284 ms 776388 KB Output is correct
53 Correct 1185 ms 775476 KB Output is correct
54 Correct 144 ms 613368 KB Output is correct
55 Correct 144 ms 613200 KB Output is correct
56 Correct 144 ms 613344 KB Output is correct
57 Correct 143 ms 613040 KB Output is correct
58 Correct 148 ms 613304 KB Output is correct
59 Correct 144 ms 613204 KB Output is correct
60 Correct 144 ms 613024 KB Output is correct
61 Correct 145 ms 613168 KB Output is correct
62 Correct 145 ms 613200 KB Output is correct
63 Correct 145 ms 613052 KB Output is correct
64 Correct 145 ms 613204 KB Output is correct
65 Correct 144 ms 613192 KB Output is correct
66 Correct 144 ms 613100 KB Output is correct
67 Correct 146 ms 613204 KB Output is correct
68 Correct 144 ms 613200 KB Output is correct
69 Correct 149 ms 613156 KB Output is correct
70 Correct 145 ms 613200 KB Output is correct
71 Correct 144 ms 613188 KB Output is correct
72 Correct 161 ms 613140 KB Output is correct
73 Correct 144 ms 613056 KB Output is correct
74 Correct 145 ms 613084 KB Output is correct
75 Correct 146 ms 613100 KB Output is correct
76 Correct 151 ms 613176 KB Output is correct
77 Correct 143 ms 613200 KB Output is correct
78 Correct 147 ms 613204 KB Output is correct
79 Correct 143 ms 613208 KB Output is correct
80 Correct 145 ms 613164 KB Output is correct
81 Correct 146 ms 613084 KB Output is correct
82 Correct 147 ms 613200 KB Output is correct
83 Correct 148 ms 613148 KB Output is correct
84 Correct 146 ms 613204 KB Output is correct
85 Correct 146 ms 613204 KB Output is correct
86 Correct 144 ms 612996 KB Output is correct
87 Correct 146 ms 613208 KB Output is correct
88 Correct 144 ms 612968 KB Output is correct
89 Correct 142 ms 612988 KB Output is correct
90 Correct 142 ms 613140 KB Output is correct
91 Correct 146 ms 613204 KB Output is correct
92 Correct 150 ms 613204 KB Output is correct
93 Correct 142 ms 613196 KB Output is correct
94 Correct 149 ms 613424 KB Output is correct
95 Correct 141 ms 613200 KB Output is correct
96 Correct 145 ms 613156 KB Output is correct
97 Correct 147 ms 613092 KB Output is correct
98 Correct 143 ms 613200 KB Output is correct
99 Correct 144 ms 613156 KB Output is correct
100 Correct 144 ms 613200 KB Output is correct
101 Correct 142 ms 613208 KB Output is correct
102 Correct 145 ms 612988 KB Output is correct
103 Correct 143 ms 613204 KB Output is correct
104 Correct 143 ms 613052 KB Output is correct
105 Correct 147 ms 613004 KB Output is correct
106 Correct 143 ms 613136 KB Output is correct
107 Correct 143 ms 613204 KB Output is correct
108 Correct 146 ms 613200 KB Output is correct
109 Correct 144 ms 613188 KB Output is correct
110 Correct 162 ms 616788 KB Output is correct
111 Correct 168 ms 618324 KB Output is correct
112 Correct 169 ms 619052 KB Output is correct
113 Correct 171 ms 618936 KB Output is correct
114 Correct 167 ms 618828 KB Output is correct
115 Correct 170 ms 618944 KB Output is correct
116 Correct 171 ms 618884 KB Output is correct
117 Correct 170 ms 618832 KB Output is correct
118 Correct 175 ms 618844 KB Output is correct
119 Correct 203 ms 624976 KB Output is correct
120 Correct 208 ms 627636 KB Output is correct
121 Correct 206 ms 627796 KB Output is correct
122 Correct 195 ms 627240 KB Output is correct
123 Correct 196 ms 627184 KB Output is correct
124 Correct 392 ms 659560 KB Output is correct
125 Correct 1014 ms 751508 KB Output is correct
126 Correct 1079 ms 777692 KB Output is correct
127 Correct 989 ms 776784 KB Output is correct
128 Correct 649 ms 764708 KB Output is correct
129 Correct 641 ms 764560 KB Output is correct
130 Correct 1100 ms 777276 KB Output is correct
131 Correct 1101 ms 777184 KB Output is correct
132 Correct 171 ms 618832 KB Output is correct
133 Correct 144 ms 613200 KB Output is correct
134 Correct 144 ms 613440 KB Output is correct
135 Correct 160 ms 616788 KB Output is correct
136 Correct 159 ms 617340 KB Output is correct
137 Correct 171 ms 618292 KB Output is correct
138 Correct 168 ms 618836 KB Output is correct
139 Correct 180 ms 618836 KB Output is correct
140 Correct 166 ms 618748 KB Output is correct
141 Correct 166 ms 618800 KB Output is correct
142 Correct 161 ms 618580 KB Output is correct
143 Correct 162 ms 618736 KB Output is correct
144 Correct 167 ms 618836 KB Output is correct
145 Correct 164 ms 618836 KB Output is correct
146 Correct 163 ms 618832 KB Output is correct
147 Correct 165 ms 618836 KB Output is correct
148 Correct 166 ms 618748 KB Output is correct
149 Correct 171 ms 618836 KB Output is correct
150 Correct 167 ms 618688 KB Output is correct
151 Correct 171 ms 618836 KB Output is correct
152 Correct 173 ms 618712 KB Output is correct
153 Correct 172 ms 618804 KB Output is correct
154 Correct 208 ms 627692 KB Output is correct
155 Correct 170 ms 618836 KB Output is correct
156 Correct 204 ms 625236 KB Output is correct
157 Correct 204 ms 626260 KB Output is correct
158 Correct 208 ms 627796 KB Output is correct
159 Correct 233 ms 627840 KB Output is correct
160 Correct 218 ms 627536 KB Output is correct
161 Correct 218 ms 627792 KB Output is correct
162 Correct 250 ms 627540 KB Output is correct
163 Correct 191 ms 627092 KB Output is correct
164 Correct 196 ms 627388 KB Output is correct
165 Correct 201 ms 627796 KB Output is correct
166 Correct 199 ms 627396 KB Output is correct
167 Correct 204 ms 627536 KB Output is correct
168 Correct 216 ms 627796 KB Output is correct
169 Correct 215 ms 627536 KB Output is correct
170 Correct 210 ms 627488 KB Output is correct
171 Correct 238 ms 627792 KB Output is correct
172 Correct 231 ms 627604 KB Output is correct
173 Correct 214 ms 627536 KB Output is correct
174 Correct 241 ms 632312 KB Output is correct
175 Correct 304 ms 647760 KB Output is correct
176 Correct 498 ms 694440 KB Output is correct
177 Correct 734 ms 720980 KB Output is correct
178 Correct 936 ms 754456 KB Output is correct
179 Correct 899 ms 775660 KB Output is correct
180 Correct 1033 ms 775252 KB Output is correct
181 Correct 1082 ms 775460 KB Output is correct
182 Correct 1107 ms 775592 KB Output is correct
183 Correct 1034 ms 775480 KB Output is correct
184 Execution timed out 2045 ms 940764 KB Time limit exceeded
185 Halted 0 ms 0 KB -