Submission #928583

# Submission time Handle Problem Language Result Execution time Memory
928583 2024-02-16T17:20:28 Z koukirocks Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 24488 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.emplace_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.emplace_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.emplace_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.emplace_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.emplace_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.emplace_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 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 344 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 1 ms 348 KB Output is correct
13 Correct 1 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 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 4 ms 604 KB Output is correct
20 Correct 2 ms 676 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 5 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 4 ms 604 KB Output is correct
27 Correct 5 ms 744 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1136 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 6 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1140 KB Output is correct
34 Correct 5 ms 1628 KB Output is correct
35 Correct 4 ms 1628 KB Output is correct
36 Correct 13 ms 1368 KB Output is correct
37 Correct 11 ms 1116 KB Output is correct
38 Correct 6 ms 1116 KB Output is correct
39 Correct 73 ms 6872 KB Output is correct
40 Correct 13 ms 1116 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 14 ms 1372 KB Output is correct
43 Correct 10 ms 1884 KB Output is correct
44 Correct 46 ms 3932 KB Output is correct
45 Correct 44 ms 4188 KB Output is correct
46 Correct 68 ms 12464 KB Output is correct
47 Correct 106 ms 6908 KB Output is correct
48 Correct 62 ms 7140 KB Output is correct
49 Correct 44 ms 12196 KB Output is correct
50 Correct 33 ms 12196 KB Output is correct
51 Correct 107 ms 7112 KB Output is correct
52 Correct 104 ms 6744 KB Output is correct
53 Correct 65 ms 6908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 344 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 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 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 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 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 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 600 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 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 4 ms 604 KB Output is correct
26 Correct 7 ms 1116 KB Output is correct
27 Correct 3 ms 860 KB Output is correct
28 Correct 2 ms 860 KB Output is correct
29 Correct 2 ms 604 KB Output is correct
30 Correct 1 ms 600 KB Output is correct
31 Correct 11 ms 756 KB Output is correct
32 Correct 5 ms 604 KB Output is correct
33 Correct 4 ms 604 KB Output is correct
34 Correct 86 ms 2044 KB Output is correct
35 Correct 7 ms 1624 KB Output is correct
36 Correct 5 ms 1880 KB Output is correct
37 Correct 3 ms 1116 KB Output is correct
38 Correct 2 ms 1116 KB Output is correct
39 Correct 190 ms 6404 KB Output is correct
40 Correct 907 ms 17884 KB Output is correct
41 Correct 65 ms 12508 KB Output is correct
42 Correct 57 ms 12368 KB Output is correct
43 Correct 25 ms 6748 KB Output is correct
44 Correct 16 ms 6744 KB Output is correct
45 Correct 892 ms 19716 KB Output is correct
46 Correct 1340 ms 19656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 344 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 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 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 3 ms 604 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 632 KB Output is correct
37 Correct 2 ms 604 KB Output is correct
38 Correct 7 ms 1236 KB Output is correct
39 Correct 3 ms 860 KB Output is correct
40 Correct 4 ms 604 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 2 ms 860 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 860 KB Output is correct
46 Correct 2 ms 860 KB Output is correct
47 Correct 3 ms 604 KB Output is correct
48 Correct 8 ms 604 KB Output is correct
49 Correct 16 ms 724 KB Output is correct
50 Correct 19 ms 604 KB Output is correct
51 Correct 11 ms 604 KB Output is correct
52 Correct 5 ms 604 KB Output is correct
53 Correct 5 ms 604 KB Output is correct
54 Correct 3 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 344 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 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 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 3 ms 604 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 632 KB Output is correct
37 Correct 2 ms 604 KB Output is correct
38 Correct 7 ms 1236 KB Output is correct
39 Correct 3 ms 860 KB Output is correct
40 Correct 4 ms 604 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 2 ms 860 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 860 KB Output is correct
46 Correct 2 ms 860 KB Output is correct
47 Correct 3 ms 604 KB Output is correct
48 Correct 8 ms 604 KB Output is correct
49 Correct 16 ms 724 KB Output is correct
50 Correct 19 ms 604 KB Output is correct
51 Correct 11 ms 604 KB Output is correct
52 Correct 5 ms 604 KB Output is correct
53 Correct 5 ms 604 KB Output is correct
54 Correct 3 ms 604 KB Output is correct
55 Correct 7 ms 1112 KB Output is correct
56 Correct 4 ms 604 KB Output is correct
57 Correct 87 ms 2148 KB Output is correct
58 Correct 14 ms 860 KB Output is correct
59 Correct 6 ms 1628 KB Output is correct
60 Correct 12 ms 1112 KB Output is correct
61 Correct 9 ms 1272 KB Output is correct
62 Correct 6 ms 1880 KB Output is correct
63 Correct 3 ms 1116 KB Output is correct
64 Correct 2 ms 1116 KB Output is correct
65 Correct 5 ms 1628 KB Output is correct
66 Correct 4 ms 1880 KB Output is correct
67 Correct 9 ms 1372 KB Output is correct
68 Correct 30 ms 860 KB Output is correct
69 Correct 43 ms 1116 KB Output is correct
70 Correct 66 ms 1116 KB Output is correct
71 Correct 76 ms 1252 KB Output is correct
72 Correct 14 ms 1112 KB Output is correct
73 Correct 11 ms 1116 KB Output is correct
74 Correct 6 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 344 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 1 ms 348 KB Output is correct
13 Correct 1 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 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 4 ms 604 KB Output is correct
20 Correct 2 ms 676 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 5 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 4 ms 604 KB Output is correct
27 Correct 5 ms 744 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1136 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 6 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1140 KB Output is correct
34 Correct 5 ms 1628 KB Output is correct
35 Correct 4 ms 1628 KB Output is correct
36 Correct 13 ms 1368 KB Output is correct
37 Correct 11 ms 1116 KB Output is correct
38 Correct 6 ms 1116 KB Output is correct
39 Correct 73 ms 6872 KB Output is correct
40 Correct 13 ms 1116 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 14 ms 1372 KB Output is correct
43 Correct 10 ms 1884 KB Output is correct
44 Correct 46 ms 3932 KB Output is correct
45 Correct 44 ms 4188 KB Output is correct
46 Correct 68 ms 12464 KB Output is correct
47 Correct 106 ms 6908 KB Output is correct
48 Correct 62 ms 7140 KB Output is correct
49 Correct 44 ms 12196 KB Output is correct
50 Correct 33 ms 12196 KB Output is correct
51 Correct 107 ms 7112 KB Output is correct
52 Correct 104 ms 6744 KB Output is correct
53 Correct 65 ms 6908 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 600 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 1 ms 344 KB Output is correct
62 Correct 0 ms 600 KB Output is correct
63 Correct 0 ms 344 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 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 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 348 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 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 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 0 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 344 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 0 ms 348 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 600 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 0 ms 348 KB Output is correct
109 Correct 1 ms 344 KB Output is correct
110 Correct 4 ms 604 KB Output is correct
111 Correct 7 ms 1116 KB Output is correct
112 Correct 3 ms 860 KB Output is correct
113 Correct 2 ms 860 KB Output is correct
114 Correct 2 ms 604 KB Output is correct
115 Correct 1 ms 600 KB Output is correct
116 Correct 11 ms 756 KB Output is correct
117 Correct 5 ms 604 KB Output is correct
118 Correct 4 ms 604 KB Output is correct
119 Correct 86 ms 2044 KB Output is correct
120 Correct 7 ms 1624 KB Output is correct
121 Correct 5 ms 1880 KB Output is correct
122 Correct 3 ms 1116 KB Output is correct
123 Correct 2 ms 1116 KB Output is correct
124 Correct 190 ms 6404 KB Output is correct
125 Correct 907 ms 17884 KB Output is correct
126 Correct 65 ms 12508 KB Output is correct
127 Correct 57 ms 12368 KB Output is correct
128 Correct 25 ms 6748 KB Output is correct
129 Correct 16 ms 6744 KB Output is correct
130 Correct 892 ms 19716 KB Output is correct
131 Correct 1340 ms 19656 KB Output is correct
132 Correct 3 ms 604 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 632 KB Output is correct
136 Correct 2 ms 604 KB Output is correct
137 Correct 7 ms 1236 KB Output is correct
138 Correct 3 ms 860 KB Output is correct
139 Correct 4 ms 604 KB Output is correct
140 Correct 3 ms 604 KB Output is correct
141 Correct 2 ms 860 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 860 KB Output is correct
145 Correct 2 ms 860 KB Output is correct
146 Correct 3 ms 604 KB Output is correct
147 Correct 8 ms 604 KB Output is correct
148 Correct 16 ms 724 KB Output is correct
149 Correct 19 ms 604 KB Output is correct
150 Correct 11 ms 604 KB Output is correct
151 Correct 5 ms 604 KB Output is correct
152 Correct 5 ms 604 KB Output is correct
153 Correct 3 ms 604 KB Output is correct
154 Correct 7 ms 1112 KB Output is correct
155 Correct 4 ms 604 KB Output is correct
156 Correct 87 ms 2148 KB Output is correct
157 Correct 14 ms 860 KB Output is correct
158 Correct 6 ms 1628 KB Output is correct
159 Correct 12 ms 1112 KB Output is correct
160 Correct 9 ms 1272 KB Output is correct
161 Correct 6 ms 1880 KB Output is correct
162 Correct 3 ms 1116 KB Output is correct
163 Correct 2 ms 1116 KB Output is correct
164 Correct 5 ms 1628 KB Output is correct
165 Correct 4 ms 1880 KB Output is correct
166 Correct 9 ms 1372 KB Output is correct
167 Correct 30 ms 860 KB Output is correct
168 Correct 43 ms 1116 KB Output is correct
169 Correct 66 ms 1116 KB Output is correct
170 Correct 76 ms 1252 KB Output is correct
171 Correct 14 ms 1112 KB Output is correct
172 Correct 11 ms 1116 KB Output is correct
173 Correct 6 ms 1152 KB Output is correct
174 Correct 21 ms 1116 KB Output is correct
175 Correct 108 ms 1892 KB Output is correct
176 Correct 29 ms 4440 KB Output is correct
177 Correct 176 ms 4700 KB Output is correct
178 Correct 308 ms 6100 KB Output is correct
179 Correct 334 ms 6844 KB Output is correct
180 Correct 788 ms 6740 KB Output is correct
181 Correct 1224 ms 7296 KB Output is correct
182 Correct 1984 ms 8020 KB Output is correct
183 Correct 621 ms 8592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 344 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 1 ms 348 KB Output is correct
13 Correct 1 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 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 4 ms 604 KB Output is correct
20 Correct 2 ms 676 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 5 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 4 ms 604 KB Output is correct
27 Correct 5 ms 744 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1136 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 6 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1140 KB Output is correct
34 Correct 5 ms 1628 KB Output is correct
35 Correct 4 ms 1628 KB Output is correct
36 Correct 13 ms 1368 KB Output is correct
37 Correct 11 ms 1116 KB Output is correct
38 Correct 6 ms 1116 KB Output is correct
39 Correct 73 ms 6872 KB Output is correct
40 Correct 13 ms 1116 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 14 ms 1372 KB Output is correct
43 Correct 10 ms 1884 KB Output is correct
44 Correct 46 ms 3932 KB Output is correct
45 Correct 44 ms 4188 KB Output is correct
46 Correct 68 ms 12464 KB Output is correct
47 Correct 106 ms 6908 KB Output is correct
48 Correct 62 ms 7140 KB Output is correct
49 Correct 44 ms 12196 KB Output is correct
50 Correct 33 ms 12196 KB Output is correct
51 Correct 107 ms 7112 KB Output is correct
52 Correct 104 ms 6744 KB Output is correct
53 Correct 65 ms 6908 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 600 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 1 ms 344 KB Output is correct
62 Correct 0 ms 600 KB Output is correct
63 Correct 0 ms 344 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 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 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 348 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 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 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 0 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 344 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 0 ms 348 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 600 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 0 ms 348 KB Output is correct
109 Correct 1 ms 344 KB Output is correct
110 Correct 4 ms 604 KB Output is correct
111 Correct 7 ms 1116 KB Output is correct
112 Correct 3 ms 860 KB Output is correct
113 Correct 2 ms 860 KB Output is correct
114 Correct 2 ms 604 KB Output is correct
115 Correct 1 ms 600 KB Output is correct
116 Correct 11 ms 756 KB Output is correct
117 Correct 5 ms 604 KB Output is correct
118 Correct 4 ms 604 KB Output is correct
119 Correct 86 ms 2044 KB Output is correct
120 Correct 7 ms 1624 KB Output is correct
121 Correct 5 ms 1880 KB Output is correct
122 Correct 3 ms 1116 KB Output is correct
123 Correct 2 ms 1116 KB Output is correct
124 Correct 190 ms 6404 KB Output is correct
125 Correct 907 ms 17884 KB Output is correct
126 Correct 65 ms 12508 KB Output is correct
127 Correct 57 ms 12368 KB Output is correct
128 Correct 25 ms 6748 KB Output is correct
129 Correct 16 ms 6744 KB Output is correct
130 Correct 892 ms 19716 KB Output is correct
131 Correct 1340 ms 19656 KB Output is correct
132 Correct 3 ms 604 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 632 KB Output is correct
136 Correct 2 ms 604 KB Output is correct
137 Correct 7 ms 1236 KB Output is correct
138 Correct 3 ms 860 KB Output is correct
139 Correct 4 ms 604 KB Output is correct
140 Correct 3 ms 604 KB Output is correct
141 Correct 2 ms 860 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 860 KB Output is correct
145 Correct 2 ms 860 KB Output is correct
146 Correct 3 ms 604 KB Output is correct
147 Correct 8 ms 604 KB Output is correct
148 Correct 16 ms 724 KB Output is correct
149 Correct 19 ms 604 KB Output is correct
150 Correct 11 ms 604 KB Output is correct
151 Correct 5 ms 604 KB Output is correct
152 Correct 5 ms 604 KB Output is correct
153 Correct 3 ms 604 KB Output is correct
154 Correct 7 ms 1112 KB Output is correct
155 Correct 4 ms 604 KB Output is correct
156 Correct 87 ms 2148 KB Output is correct
157 Correct 14 ms 860 KB Output is correct
158 Correct 6 ms 1628 KB Output is correct
159 Correct 12 ms 1112 KB Output is correct
160 Correct 9 ms 1272 KB Output is correct
161 Correct 6 ms 1880 KB Output is correct
162 Correct 3 ms 1116 KB Output is correct
163 Correct 2 ms 1116 KB Output is correct
164 Correct 5 ms 1628 KB Output is correct
165 Correct 4 ms 1880 KB Output is correct
166 Correct 9 ms 1372 KB Output is correct
167 Correct 30 ms 860 KB Output is correct
168 Correct 43 ms 1116 KB Output is correct
169 Correct 66 ms 1116 KB Output is correct
170 Correct 76 ms 1252 KB Output is correct
171 Correct 14 ms 1112 KB Output is correct
172 Correct 11 ms 1116 KB Output is correct
173 Correct 6 ms 1152 KB Output is correct
174 Correct 21 ms 1116 KB Output is correct
175 Correct 108 ms 1892 KB Output is correct
176 Correct 29 ms 4440 KB Output is correct
177 Correct 176 ms 4700 KB Output is correct
178 Correct 308 ms 6100 KB Output is correct
179 Correct 334 ms 6844 KB Output is correct
180 Correct 788 ms 6740 KB Output is correct
181 Correct 1224 ms 7296 KB Output is correct
182 Correct 1984 ms 8020 KB Output is correct
183 Correct 621 ms 8592 KB Output is correct
184 Correct 162 ms 13148 KB Output is correct
185 Correct 186 ms 7576 KB Output is correct
186 Correct 323 ms 24488 KB Output is correct
187 Correct 1340 ms 10576 KB Output is correct
188 Correct 150 ms 24292 KB Output is correct
189 Correct 209 ms 13232 KB Output is correct
190 Correct 140 ms 13208 KB Output is correct
191 Correct 120 ms 24120 KB Output is correct
192 Correct 50 ms 13148 KB Output is correct
193 Correct 31 ms 13148 KB Output is correct
194 Correct 91 ms 24300 KB Output is correct
195 Correct 66 ms 24296 KB Output is correct
196 Correct 1761 ms 13168 KB Output is correct
197 Correct 1155 ms 13368 KB Output is correct
198 Correct 1500 ms 13664 KB Output is correct
199 Execution timed out 2056 ms 13928 KB Time limit exceeded
200 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 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 0 ms 348 KB Output is correct
7 Correct 0 ms 344 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 1 ms 348 KB Output is correct
13 Correct 1 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 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 4 ms 604 KB Output is correct
20 Correct 2 ms 676 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 5 ms 604 KB Output is correct
23 Correct 3 ms 604 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 4 ms 604 KB Output is correct
27 Correct 5 ms 744 KB Output is correct
28 Correct 3 ms 604 KB Output is correct
29 Correct 7 ms 1136 KB Output is correct
30 Correct 4 ms 604 KB Output is correct
31 Correct 6 ms 1628 KB Output is correct
32 Correct 11 ms 1116 KB Output is correct
33 Correct 7 ms 1140 KB Output is correct
34 Correct 5 ms 1628 KB Output is correct
35 Correct 4 ms 1628 KB Output is correct
36 Correct 13 ms 1368 KB Output is correct
37 Correct 11 ms 1116 KB Output is correct
38 Correct 6 ms 1116 KB Output is correct
39 Correct 73 ms 6872 KB Output is correct
40 Correct 13 ms 1116 KB Output is correct
41 Correct 7 ms 1884 KB Output is correct
42 Correct 14 ms 1372 KB Output is correct
43 Correct 10 ms 1884 KB Output is correct
44 Correct 46 ms 3932 KB Output is correct
45 Correct 44 ms 4188 KB Output is correct
46 Correct 68 ms 12464 KB Output is correct
47 Correct 106 ms 6908 KB Output is correct
48 Correct 62 ms 7140 KB Output is correct
49 Correct 44 ms 12196 KB Output is correct
50 Correct 33 ms 12196 KB Output is correct
51 Correct 107 ms 7112 KB Output is correct
52 Correct 104 ms 6744 KB Output is correct
53 Correct 65 ms 6908 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 600 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 1 ms 344 KB Output is correct
62 Correct 0 ms 600 KB Output is correct
63 Correct 0 ms 344 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 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 0 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 348 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 0 ms 348 KB Output is correct
79 Correct 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 0 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 0 ms 344 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 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 0 ms 348 KB Output is correct
93 Correct 0 ms 348 KB Output is correct
94 Correct 0 ms 344 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 0 ms 348 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 600 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 0 ms 348 KB Output is correct
109 Correct 1 ms 344 KB Output is correct
110 Correct 4 ms 604 KB Output is correct
111 Correct 7 ms 1116 KB Output is correct
112 Correct 3 ms 860 KB Output is correct
113 Correct 2 ms 860 KB Output is correct
114 Correct 2 ms 604 KB Output is correct
115 Correct 1 ms 600 KB Output is correct
116 Correct 11 ms 756 KB Output is correct
117 Correct 5 ms 604 KB Output is correct
118 Correct 4 ms 604 KB Output is correct
119 Correct 86 ms 2044 KB Output is correct
120 Correct 7 ms 1624 KB Output is correct
121 Correct 5 ms 1880 KB Output is correct
122 Correct 3 ms 1116 KB Output is correct
123 Correct 2 ms 1116 KB Output is correct
124 Correct 190 ms 6404 KB Output is correct
125 Correct 907 ms 17884 KB Output is correct
126 Correct 65 ms 12508 KB Output is correct
127 Correct 57 ms 12368 KB Output is correct
128 Correct 25 ms 6748 KB Output is correct
129 Correct 16 ms 6744 KB Output is correct
130 Correct 892 ms 19716 KB Output is correct
131 Correct 1340 ms 19656 KB Output is correct
132 Correct 3 ms 604 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 632 KB Output is correct
136 Correct 2 ms 604 KB Output is correct
137 Correct 7 ms 1236 KB Output is correct
138 Correct 3 ms 860 KB Output is correct
139 Correct 4 ms 604 KB Output is correct
140 Correct 3 ms 604 KB Output is correct
141 Correct 2 ms 860 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 860 KB Output is correct
145 Correct 2 ms 860 KB Output is correct
146 Correct 3 ms 604 KB Output is correct
147 Correct 8 ms 604 KB Output is correct
148 Correct 16 ms 724 KB Output is correct
149 Correct 19 ms 604 KB Output is correct
150 Correct 11 ms 604 KB Output is correct
151 Correct 5 ms 604 KB Output is correct
152 Correct 5 ms 604 KB Output is correct
153 Correct 3 ms 604 KB Output is correct
154 Correct 7 ms 1112 KB Output is correct
155 Correct 4 ms 604 KB Output is correct
156 Correct 87 ms 2148 KB Output is correct
157 Correct 14 ms 860 KB Output is correct
158 Correct 6 ms 1628 KB Output is correct
159 Correct 12 ms 1112 KB Output is correct
160 Correct 9 ms 1272 KB Output is correct
161 Correct 6 ms 1880 KB Output is correct
162 Correct 3 ms 1116 KB Output is correct
163 Correct 2 ms 1116 KB Output is correct
164 Correct 5 ms 1628 KB Output is correct
165 Correct 4 ms 1880 KB Output is correct
166 Correct 9 ms 1372 KB Output is correct
167 Correct 30 ms 860 KB Output is correct
168 Correct 43 ms 1116 KB Output is correct
169 Correct 66 ms 1116 KB Output is correct
170 Correct 76 ms 1252 KB Output is correct
171 Correct 14 ms 1112 KB Output is correct
172 Correct 11 ms 1116 KB Output is correct
173 Correct 6 ms 1152 KB Output is correct
174 Correct 21 ms 1116 KB Output is correct
175 Correct 108 ms 1892 KB Output is correct
176 Correct 29 ms 4440 KB Output is correct
177 Correct 176 ms 4700 KB Output is correct
178 Correct 308 ms 6100 KB Output is correct
179 Correct 334 ms 6844 KB Output is correct
180 Correct 788 ms 6740 KB Output is correct
181 Correct 1224 ms 7296 KB Output is correct
182 Correct 1984 ms 8020 KB Output is correct
183 Correct 621 ms 8592 KB Output is correct
184 Correct 162 ms 13148 KB Output is correct
185 Correct 186 ms 7576 KB Output is correct
186 Correct 323 ms 24488 KB Output is correct
187 Correct 1340 ms 10576 KB Output is correct
188 Correct 150 ms 24292 KB Output is correct
189 Correct 209 ms 13232 KB Output is correct
190 Correct 140 ms 13208 KB Output is correct
191 Correct 120 ms 24120 KB Output is correct
192 Correct 50 ms 13148 KB Output is correct
193 Correct 31 ms 13148 KB Output is correct
194 Correct 91 ms 24300 KB Output is correct
195 Correct 66 ms 24296 KB Output is correct
196 Correct 1761 ms 13168 KB Output is correct
197 Correct 1155 ms 13368 KB Output is correct
198 Correct 1500 ms 13664 KB Output is correct
199 Execution timed out 2056 ms 13928 KB Time limit exceeded
200 Halted 0 ms 0 KB -