Submission #928511

# Submission time Handle Problem Language Result Execution time Memory
928511 2024-02-16T13:58:36 Z koukirocks Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 27364 KB
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0); cin.tie(0)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const ll MAX=5e5+10,P=1e9+7;
const ll INF=0x3f3f3f3f,oo=0x3f3f3f3f3f3f3f3f;

const int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}};
int r,c,n;
pii s,g;
vector<vector<bool> > mp,vis;
vector<vector<int> > dis;

bool in(int x,int y) {
	return x>=0 and x<r and y>=0 and y<c;
}

bool inrg(int vx,int vy,int tgx,int tgy) {
	int dx=abs(tgx-vx);
	int dy=abs(tgy-vy);
	if (max(dx,dy)<=n and !(dx==n and dy==n)) return true;
	return false;
}

int main() {
	speed;
	cin>>r>>c>>n;
	cin>>s.first>>s.second;
	s.first--;s.second--;
	cin>>g.first>>g.second;
	g.first--;g.second--;
	mp.resize(r,vector<bool>(c));
	dis.resize(r,vector<int>(c,INF));
	vis.resize(r,vector<bool>(c,0));
	for (int i=0;i<r;i++) {
		for (int j=0;j<c;j++) {
			char c;
			cin>>c;
			if (c=='.') mp[i][j]=0;
			else mp[i][j]=1;
		}
	}
	deque<pii> DBFS;
	dis[s.first][s.second]=0;
	DBFS.push_front(s);
	while (!DBFS.empty()) {
		while (!DBFS.empty() and vis[DBFS.front().first][DBFS.front().second]) DBFS.pop_front();
		if (DBFS.empty()) break;
		auto [vx,vy]=DBFS.front();
//		cout<<vx<<" "<<vy<<"\n"<<flush;
		DBFS.pop_front();
		vis[vx][vy]=true;
		for (int k=0;k<4;k++) {
			int nx=vx+dir[k][0];
			int ny=vy+dir[k][1];
//			cout<<nx<<" "<<ny<<" n\n";
//			if (in(nx,ny)) cout<<dis[nx][ny]<<" "<<dis[vx][vy]<<" "<<mp[nx][ny]<<"\n";
			if (in(nx,ny) and !mp[nx][ny] and dis[nx][ny]>dis[vx][vy]) {
				DBFS.push_front({nx,ny});
				dis[nx][ny]=dis[vx][vy];
			}
		}
		if (inrg(vx,vy,g.first,g.second)) {
			if (dis[g.first][g.second]>dis[vx][vy]+1) {
				dis[g.first][g.second]=dis[vx][vy]+1;
				DBFS.push_back(g);
			}
			continue;
		}
		for (int k=1;k<2*n;k++) {
			{ // up
				int nx=vx-n;
				int ny=vy-n+k;
//				cout<<nx<<" "<<ny<<" nn\n";
				if (in(nx,ny) and dis[nx][ny]>dis[vx][vy]+1) {
					DBFS.push_back({nx,ny});
					dis[nx][ny]=dis[vx][vy]+1;
				}
			}
			{ // right
				int nx=vx-n+k;
				int ny=vy+n;
//				cout<<nx<<" "<<ny<<" nn\n";
				if (in(nx,ny) and dis[nx][ny]>dis[vx][vy]+1) {
					DBFS.push_back({nx,ny});
					dis[nx][ny]=dis[vx][vy]+1;
				}
			}
			{ // down
				int nx=vx+n;
				int ny=vy-n+k;
//				cout<<nx<<" "<<ny<<" nn\n";
				if (in(nx,ny) and dis[nx][ny]>dis[vx][vy]+1) {
					DBFS.push_back({nx,ny});
					dis[nx][ny]=dis[vx][vy]+1;
				}
			}
			{ // left
				int nx=vx-n+k;
				int ny=vy-n;
//				cout<<nx<<" "<<ny<<" nn\n";
				if (in(nx,ny) and dis[nx][ny]>dis[vx][vy]+1) {
					DBFS.push_back({nx,ny});
					dis[nx][ny]=dis[vx][vy]+1;
				}
			}
		}
	}
//	for (int i=0;i<r;i++) {
//		for (int j=0;j<c;j++) cout<<dis[i][j]<<" ";
//		cout<<"\n";
//	}
	cout<<dis[g.first][g.second]<<"\n";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 3 ms 748 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 3 ms 856 KB Output is correct
22 Correct 6 ms 604 KB Output is correct
23 Correct 3 ms 600 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 5 ms 604 KB Output is correct
27 Correct 5 ms 600 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1116 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 7 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1116 KB Output is correct
34 Correct 7 ms 1628 KB Output is correct
35 Correct 5 ms 1628 KB Output is correct
36 Correct 11 ms 1112 KB Output is correct
37 Correct 11 ms 1112 KB Output is correct
38 Correct 6 ms 1152 KB Output is correct
39 Correct 66 ms 6944 KB Output is correct
40 Correct 12 ms 1112 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 12 ms 1372 KB Output is correct
43 Correct 9 ms 1884 KB Output is correct
44 Correct 50 ms 3932 KB Output is correct
45 Correct 42 ms 4188 KB Output is correct
46 Correct 68 ms 12456 KB Output is correct
47 Correct 104 ms 6748 KB Output is correct
48 Correct 61 ms 6880 KB Output is correct
49 Correct 46 ms 12192 KB Output is correct
50 Correct 35 ms 12196 KB Output is correct
51 Correct 118 ms 6884 KB Output is correct
52 Correct 117 ms 6992 KB Output is correct
53 Correct 64 ms 6884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 504 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 4 ms 604 KB Output is correct
26 Correct 9 ms 1116 KB Output is correct
27 Correct 3 ms 860 KB Output is correct
28 Correct 3 ms 860 KB Output is correct
29 Correct 2 ms 856 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 11 ms 604 KB Output is correct
32 Correct 5 ms 740 KB Output is correct
33 Correct 4 ms 600 KB Output is correct
34 Correct 83 ms 2144 KB Output is correct
35 Correct 10 ms 1628 KB Output is correct
36 Correct 7 ms 1628 KB Output is correct
37 Correct 3 ms 1132 KB Output is correct
38 Correct 2 ms 1116 KB Output is correct
39 Correct 177 ms 6740 KB Output is correct
40 Correct 906 ms 18504 KB Output is correct
41 Correct 83 ms 13912 KB Output is correct
42 Correct 58 ms 13880 KB Output is correct
43 Correct 26 ms 8272 KB Output is correct
44 Correct 16 ms 8276 KB Output is correct
45 Correct 860 ms 21368 KB Output is correct
46 Correct 1277 ms 21264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 4 ms 740 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 4 ms 604 KB Output is correct
37 Correct 2 ms 676 KB Output is correct
38 Correct 8 ms 1112 KB Output is correct
39 Correct 3 ms 860 KB Output is correct
40 Correct 5 ms 748 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 3 ms 856 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 2 ms 856 KB Output is correct
46 Correct 2 ms 860 KB Output is correct
47 Correct 4 ms 820 KB Output is correct
48 Correct 8 ms 604 KB Output is correct
49 Correct 13 ms 732 KB Output is correct
50 Correct 18 ms 604 KB Output is correct
51 Correct 14 ms 716 KB Output is correct
52 Correct 5 ms 856 KB Output is correct
53 Correct 5 ms 600 KB Output is correct
54 Correct 3 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 4 ms 740 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 4 ms 604 KB Output is correct
37 Correct 2 ms 676 KB Output is correct
38 Correct 8 ms 1112 KB Output is correct
39 Correct 3 ms 860 KB Output is correct
40 Correct 5 ms 748 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 3 ms 856 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 2 ms 856 KB Output is correct
46 Correct 2 ms 860 KB Output is correct
47 Correct 4 ms 820 KB Output is correct
48 Correct 8 ms 604 KB Output is correct
49 Correct 13 ms 732 KB Output is correct
50 Correct 18 ms 604 KB Output is correct
51 Correct 14 ms 716 KB Output is correct
52 Correct 5 ms 856 KB Output is correct
53 Correct 5 ms 600 KB Output is correct
54 Correct 3 ms 600 KB Output is correct
55 Correct 7 ms 1112 KB Output is correct
56 Correct 4 ms 600 KB Output is correct
57 Correct 91 ms 2108 KB Output is correct
58 Correct 15 ms 860 KB Output is correct
59 Correct 7 ms 1712 KB Output is correct
60 Correct 13 ms 1372 KB Output is correct
61 Correct 6 ms 1116 KB Output is correct
62 Correct 5 ms 1628 KB Output is correct
63 Correct 3 ms 1116 KB Output is correct
64 Correct 2 ms 1260 KB Output is correct
65 Correct 5 ms 1628 KB Output is correct
66 Correct 6 ms 1628 KB Output is correct
67 Correct 9 ms 1368 KB Output is correct
68 Correct 28 ms 1240 KB Output is correct
69 Correct 41 ms 1112 KB Output is correct
70 Correct 60 ms 1360 KB Output is correct
71 Correct 73 ms 1388 KB Output is correct
72 Correct 11 ms 1344 KB Output is correct
73 Correct 12 ms 1116 KB Output is correct
74 Correct 7 ms 1292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 3 ms 748 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 3 ms 856 KB Output is correct
22 Correct 6 ms 604 KB Output is correct
23 Correct 3 ms 600 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 5 ms 604 KB Output is correct
27 Correct 5 ms 600 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1116 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 7 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1116 KB Output is correct
34 Correct 7 ms 1628 KB Output is correct
35 Correct 5 ms 1628 KB Output is correct
36 Correct 11 ms 1112 KB Output is correct
37 Correct 11 ms 1112 KB Output is correct
38 Correct 6 ms 1152 KB Output is correct
39 Correct 66 ms 6944 KB Output is correct
40 Correct 12 ms 1112 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 12 ms 1372 KB Output is correct
43 Correct 9 ms 1884 KB Output is correct
44 Correct 50 ms 3932 KB Output is correct
45 Correct 42 ms 4188 KB Output is correct
46 Correct 68 ms 12456 KB Output is correct
47 Correct 104 ms 6748 KB Output is correct
48 Correct 61 ms 6880 KB Output is correct
49 Correct 46 ms 12192 KB Output is correct
50 Correct 35 ms 12196 KB Output is correct
51 Correct 118 ms 6884 KB Output is correct
52 Correct 117 ms 6992 KB Output is correct
53 Correct 64 ms 6884 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 416 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 1 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 1 ms 344 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 1 ms 600 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 1 ms 504 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 344 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 0 ms 348 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 1 ms 348 KB Output is correct
110 Correct 4 ms 604 KB Output is correct
111 Correct 9 ms 1116 KB Output is correct
112 Correct 3 ms 860 KB Output is correct
113 Correct 3 ms 860 KB Output is correct
114 Correct 2 ms 856 KB Output is correct
115 Correct 1 ms 604 KB Output is correct
116 Correct 11 ms 604 KB Output is correct
117 Correct 5 ms 740 KB Output is correct
118 Correct 4 ms 600 KB Output is correct
119 Correct 83 ms 2144 KB Output is correct
120 Correct 10 ms 1628 KB Output is correct
121 Correct 7 ms 1628 KB Output is correct
122 Correct 3 ms 1132 KB Output is correct
123 Correct 2 ms 1116 KB Output is correct
124 Correct 177 ms 6740 KB Output is correct
125 Correct 906 ms 18504 KB Output is correct
126 Correct 83 ms 13912 KB Output is correct
127 Correct 58 ms 13880 KB Output is correct
128 Correct 26 ms 8272 KB Output is correct
129 Correct 16 ms 8276 KB Output is correct
130 Correct 860 ms 21368 KB Output is correct
131 Correct 1277 ms 21264 KB Output is correct
132 Correct 4 ms 740 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 0 ms 348 KB Output is correct
135 Correct 4 ms 604 KB Output is correct
136 Correct 2 ms 676 KB Output is correct
137 Correct 8 ms 1112 KB Output is correct
138 Correct 3 ms 860 KB Output is correct
139 Correct 5 ms 748 KB Output is correct
140 Correct 3 ms 604 KB Output is correct
141 Correct 3 ms 856 KB Output is correct
142 Correct 1 ms 604 KB Output is correct
143 Correct 1 ms 604 KB Output is correct
144 Correct 2 ms 856 KB Output is correct
145 Correct 2 ms 860 KB Output is correct
146 Correct 4 ms 820 KB Output is correct
147 Correct 8 ms 604 KB Output is correct
148 Correct 13 ms 732 KB Output is correct
149 Correct 18 ms 604 KB Output is correct
150 Correct 14 ms 716 KB Output is correct
151 Correct 5 ms 856 KB Output is correct
152 Correct 5 ms 600 KB Output is correct
153 Correct 3 ms 600 KB Output is correct
154 Correct 7 ms 1112 KB Output is correct
155 Correct 4 ms 600 KB Output is correct
156 Correct 91 ms 2108 KB Output is correct
157 Correct 15 ms 860 KB Output is correct
158 Correct 7 ms 1712 KB Output is correct
159 Correct 13 ms 1372 KB Output is correct
160 Correct 6 ms 1116 KB Output is correct
161 Correct 5 ms 1628 KB Output is correct
162 Correct 3 ms 1116 KB Output is correct
163 Correct 2 ms 1260 KB Output is correct
164 Correct 5 ms 1628 KB Output is correct
165 Correct 6 ms 1628 KB Output is correct
166 Correct 9 ms 1368 KB Output is correct
167 Correct 28 ms 1240 KB Output is correct
168 Correct 41 ms 1112 KB Output is correct
169 Correct 60 ms 1360 KB Output is correct
170 Correct 73 ms 1388 KB Output is correct
171 Correct 11 ms 1344 KB Output is correct
172 Correct 12 ms 1116 KB Output is correct
173 Correct 7 ms 1292 KB Output is correct
174 Correct 21 ms 1372 KB Output is correct
175 Correct 110 ms 2140 KB Output is correct
176 Correct 31 ms 4464 KB Output is correct
177 Correct 218 ms 5648 KB Output is correct
178 Correct 297 ms 7264 KB Output is correct
179 Correct 308 ms 8440 KB Output is correct
180 Correct 765 ms 8316 KB Output is correct
181 Correct 1152 ms 8552 KB Output is correct
182 Correct 1855 ms 9488 KB Output is correct
183 Correct 606 ms 10056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 3 ms 748 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 3 ms 856 KB Output is correct
22 Correct 6 ms 604 KB Output is correct
23 Correct 3 ms 600 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 5 ms 604 KB Output is correct
27 Correct 5 ms 600 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1116 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 7 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1116 KB Output is correct
34 Correct 7 ms 1628 KB Output is correct
35 Correct 5 ms 1628 KB Output is correct
36 Correct 11 ms 1112 KB Output is correct
37 Correct 11 ms 1112 KB Output is correct
38 Correct 6 ms 1152 KB Output is correct
39 Correct 66 ms 6944 KB Output is correct
40 Correct 12 ms 1112 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 12 ms 1372 KB Output is correct
43 Correct 9 ms 1884 KB Output is correct
44 Correct 50 ms 3932 KB Output is correct
45 Correct 42 ms 4188 KB Output is correct
46 Correct 68 ms 12456 KB Output is correct
47 Correct 104 ms 6748 KB Output is correct
48 Correct 61 ms 6880 KB Output is correct
49 Correct 46 ms 12192 KB Output is correct
50 Correct 35 ms 12196 KB Output is correct
51 Correct 118 ms 6884 KB Output is correct
52 Correct 117 ms 6992 KB Output is correct
53 Correct 64 ms 6884 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 416 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 1 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 1 ms 344 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 1 ms 600 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 1 ms 504 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 344 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 0 ms 348 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 1 ms 348 KB Output is correct
110 Correct 4 ms 604 KB Output is correct
111 Correct 9 ms 1116 KB Output is correct
112 Correct 3 ms 860 KB Output is correct
113 Correct 3 ms 860 KB Output is correct
114 Correct 2 ms 856 KB Output is correct
115 Correct 1 ms 604 KB Output is correct
116 Correct 11 ms 604 KB Output is correct
117 Correct 5 ms 740 KB Output is correct
118 Correct 4 ms 600 KB Output is correct
119 Correct 83 ms 2144 KB Output is correct
120 Correct 10 ms 1628 KB Output is correct
121 Correct 7 ms 1628 KB Output is correct
122 Correct 3 ms 1132 KB Output is correct
123 Correct 2 ms 1116 KB Output is correct
124 Correct 177 ms 6740 KB Output is correct
125 Correct 906 ms 18504 KB Output is correct
126 Correct 83 ms 13912 KB Output is correct
127 Correct 58 ms 13880 KB Output is correct
128 Correct 26 ms 8272 KB Output is correct
129 Correct 16 ms 8276 KB Output is correct
130 Correct 860 ms 21368 KB Output is correct
131 Correct 1277 ms 21264 KB Output is correct
132 Correct 4 ms 740 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 0 ms 348 KB Output is correct
135 Correct 4 ms 604 KB Output is correct
136 Correct 2 ms 676 KB Output is correct
137 Correct 8 ms 1112 KB Output is correct
138 Correct 3 ms 860 KB Output is correct
139 Correct 5 ms 748 KB Output is correct
140 Correct 3 ms 604 KB Output is correct
141 Correct 3 ms 856 KB Output is correct
142 Correct 1 ms 604 KB Output is correct
143 Correct 1 ms 604 KB Output is correct
144 Correct 2 ms 856 KB Output is correct
145 Correct 2 ms 860 KB Output is correct
146 Correct 4 ms 820 KB Output is correct
147 Correct 8 ms 604 KB Output is correct
148 Correct 13 ms 732 KB Output is correct
149 Correct 18 ms 604 KB Output is correct
150 Correct 14 ms 716 KB Output is correct
151 Correct 5 ms 856 KB Output is correct
152 Correct 5 ms 600 KB Output is correct
153 Correct 3 ms 600 KB Output is correct
154 Correct 7 ms 1112 KB Output is correct
155 Correct 4 ms 600 KB Output is correct
156 Correct 91 ms 2108 KB Output is correct
157 Correct 15 ms 860 KB Output is correct
158 Correct 7 ms 1712 KB Output is correct
159 Correct 13 ms 1372 KB Output is correct
160 Correct 6 ms 1116 KB Output is correct
161 Correct 5 ms 1628 KB Output is correct
162 Correct 3 ms 1116 KB Output is correct
163 Correct 2 ms 1260 KB Output is correct
164 Correct 5 ms 1628 KB Output is correct
165 Correct 6 ms 1628 KB Output is correct
166 Correct 9 ms 1368 KB Output is correct
167 Correct 28 ms 1240 KB Output is correct
168 Correct 41 ms 1112 KB Output is correct
169 Correct 60 ms 1360 KB Output is correct
170 Correct 73 ms 1388 KB Output is correct
171 Correct 11 ms 1344 KB Output is correct
172 Correct 12 ms 1116 KB Output is correct
173 Correct 7 ms 1292 KB Output is correct
174 Correct 21 ms 1372 KB Output is correct
175 Correct 110 ms 2140 KB Output is correct
176 Correct 31 ms 4464 KB Output is correct
177 Correct 218 ms 5648 KB Output is correct
178 Correct 297 ms 7264 KB Output is correct
179 Correct 308 ms 8440 KB Output is correct
180 Correct 765 ms 8316 KB Output is correct
181 Correct 1152 ms 8552 KB Output is correct
182 Correct 1855 ms 9488 KB Output is correct
183 Correct 606 ms 10056 KB Output is correct
184 Correct 146 ms 16148 KB Output is correct
185 Correct 190 ms 9108 KB Output is correct
186 Correct 316 ms 25928 KB Output is correct
187 Correct 1275 ms 12624 KB Output is correct
188 Correct 167 ms 27364 KB Output is correct
189 Correct 207 ms 15956 KB Output is correct
190 Correct 120 ms 15956 KB Output is correct
191 Correct 129 ms 27084 KB Output is correct
192 Correct 50 ms 16112 KB Output is correct
193 Correct 33 ms 15876 KB Output is correct
194 Correct 89 ms 24296 KB Output is correct
195 Correct 73 ms 24300 KB Output is correct
196 Correct 1421 ms 16104 KB Output is correct
197 Correct 1072 ms 16292 KB Output is correct
198 Correct 1436 ms 16724 KB Output is correct
199 Execution timed out 2057 ms 17000 KB Time limit exceeded
200 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 3 ms 748 KB Output is correct
20 Correct 2 ms 604 KB Output is correct
21 Correct 3 ms 856 KB Output is correct
22 Correct 6 ms 604 KB Output is correct
23 Correct 3 ms 600 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 5 ms 604 KB Output is correct
27 Correct 5 ms 600 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1116 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 7 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1116 KB Output is correct
34 Correct 7 ms 1628 KB Output is correct
35 Correct 5 ms 1628 KB Output is correct
36 Correct 11 ms 1112 KB Output is correct
37 Correct 11 ms 1112 KB Output is correct
38 Correct 6 ms 1152 KB Output is correct
39 Correct 66 ms 6944 KB Output is correct
40 Correct 12 ms 1112 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 12 ms 1372 KB Output is correct
43 Correct 9 ms 1884 KB Output is correct
44 Correct 50 ms 3932 KB Output is correct
45 Correct 42 ms 4188 KB Output is correct
46 Correct 68 ms 12456 KB Output is correct
47 Correct 104 ms 6748 KB Output is correct
48 Correct 61 ms 6880 KB Output is correct
49 Correct 46 ms 12192 KB Output is correct
50 Correct 35 ms 12196 KB Output is correct
51 Correct 118 ms 6884 KB Output is correct
52 Correct 117 ms 6992 KB Output is correct
53 Correct 64 ms 6884 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 0 ms 348 KB Output is correct
63 Correct 1 ms 416 KB Output is correct
64 Correct 0 ms 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 344 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 1 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 1 ms 344 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 1 ms 600 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 1 ms 504 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 344 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 0 ms 348 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 1 ms 348 KB Output is correct
110 Correct 4 ms 604 KB Output is correct
111 Correct 9 ms 1116 KB Output is correct
112 Correct 3 ms 860 KB Output is correct
113 Correct 3 ms 860 KB Output is correct
114 Correct 2 ms 856 KB Output is correct
115 Correct 1 ms 604 KB Output is correct
116 Correct 11 ms 604 KB Output is correct
117 Correct 5 ms 740 KB Output is correct
118 Correct 4 ms 600 KB Output is correct
119 Correct 83 ms 2144 KB Output is correct
120 Correct 10 ms 1628 KB Output is correct
121 Correct 7 ms 1628 KB Output is correct
122 Correct 3 ms 1132 KB Output is correct
123 Correct 2 ms 1116 KB Output is correct
124 Correct 177 ms 6740 KB Output is correct
125 Correct 906 ms 18504 KB Output is correct
126 Correct 83 ms 13912 KB Output is correct
127 Correct 58 ms 13880 KB Output is correct
128 Correct 26 ms 8272 KB Output is correct
129 Correct 16 ms 8276 KB Output is correct
130 Correct 860 ms 21368 KB Output is correct
131 Correct 1277 ms 21264 KB Output is correct
132 Correct 4 ms 740 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 0 ms 348 KB Output is correct
135 Correct 4 ms 604 KB Output is correct
136 Correct 2 ms 676 KB Output is correct
137 Correct 8 ms 1112 KB Output is correct
138 Correct 3 ms 860 KB Output is correct
139 Correct 5 ms 748 KB Output is correct
140 Correct 3 ms 604 KB Output is correct
141 Correct 3 ms 856 KB Output is correct
142 Correct 1 ms 604 KB Output is correct
143 Correct 1 ms 604 KB Output is correct
144 Correct 2 ms 856 KB Output is correct
145 Correct 2 ms 860 KB Output is correct
146 Correct 4 ms 820 KB Output is correct
147 Correct 8 ms 604 KB Output is correct
148 Correct 13 ms 732 KB Output is correct
149 Correct 18 ms 604 KB Output is correct
150 Correct 14 ms 716 KB Output is correct
151 Correct 5 ms 856 KB Output is correct
152 Correct 5 ms 600 KB Output is correct
153 Correct 3 ms 600 KB Output is correct
154 Correct 7 ms 1112 KB Output is correct
155 Correct 4 ms 600 KB Output is correct
156 Correct 91 ms 2108 KB Output is correct
157 Correct 15 ms 860 KB Output is correct
158 Correct 7 ms 1712 KB Output is correct
159 Correct 13 ms 1372 KB Output is correct
160 Correct 6 ms 1116 KB Output is correct
161 Correct 5 ms 1628 KB Output is correct
162 Correct 3 ms 1116 KB Output is correct
163 Correct 2 ms 1260 KB Output is correct
164 Correct 5 ms 1628 KB Output is correct
165 Correct 6 ms 1628 KB Output is correct
166 Correct 9 ms 1368 KB Output is correct
167 Correct 28 ms 1240 KB Output is correct
168 Correct 41 ms 1112 KB Output is correct
169 Correct 60 ms 1360 KB Output is correct
170 Correct 73 ms 1388 KB Output is correct
171 Correct 11 ms 1344 KB Output is correct
172 Correct 12 ms 1116 KB Output is correct
173 Correct 7 ms 1292 KB Output is correct
174 Correct 21 ms 1372 KB Output is correct
175 Correct 110 ms 2140 KB Output is correct
176 Correct 31 ms 4464 KB Output is correct
177 Correct 218 ms 5648 KB Output is correct
178 Correct 297 ms 7264 KB Output is correct
179 Correct 308 ms 8440 KB Output is correct
180 Correct 765 ms 8316 KB Output is correct
181 Correct 1152 ms 8552 KB Output is correct
182 Correct 1855 ms 9488 KB Output is correct
183 Correct 606 ms 10056 KB Output is correct
184 Correct 146 ms 16148 KB Output is correct
185 Correct 190 ms 9108 KB Output is correct
186 Correct 316 ms 25928 KB Output is correct
187 Correct 1275 ms 12624 KB Output is correct
188 Correct 167 ms 27364 KB Output is correct
189 Correct 207 ms 15956 KB Output is correct
190 Correct 120 ms 15956 KB Output is correct
191 Correct 129 ms 27084 KB Output is correct
192 Correct 50 ms 16112 KB Output is correct
193 Correct 33 ms 15876 KB Output is correct
194 Correct 89 ms 24296 KB Output is correct
195 Correct 73 ms 24300 KB Output is correct
196 Correct 1421 ms 16104 KB Output is correct
197 Correct 1072 ms 16292 KB Output is correct
198 Correct 1436 ms 16724 KB Output is correct
199 Execution timed out 2057 ms 17000 KB Time limit exceeded
200 Halted 0 ms 0 KB -