답안 #941219

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
941219 2024-03-08T09:45:43 Z dsyz Maze (JOI23_ho_t3) C++17
8 / 100
69 ms 29248 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAXN (1000005)
int main() {
	ios_base::sync_with_stdio(false);cin.tie(0);
	ll R,C,N;
	cin>>R>>C>>N;
	pair<ll,ll> start, end;
	cin>>start.first>>start.second;
	cin>>end.first>>end.second;
	start.first--, start.second--, end.first--, end.second--;
	char arr[R][C];
	for(ll i = 0;i < R;i++){
		for(ll j = 0;j < C;j++){
			cin>>arr[i][j];
		}
	}
	deque<pair<ll,ll> > dq;
	ll dist[R][C];
	bool visited[R][C];
	memset(dist,0,sizeof(dist));
	memset(visited,0,sizeof(visited));
	int Hy[] = {0,0,-1,1};
	int Wx[] = {-1,1,0,0};
	dq.push_back({start.first,start.second});
	dist[start.first][start.second] = 0;
	visited[start.first][start.second] = 1;
	while(!dq.empty()){
		ll y = dq.front().first;
		ll x = dq.front().second;
		dq.pop_front();
		visited[y][x] = 1;
		for(ll i = 0;i < 4;i++){
			ll a = y + Hy[i];
			ll b = x + Wx[i];
			if(a < 0 || a >= R || b < 0 || b >= C || visited[a][b]) continue;
			if(arr[a][b] == '#'){
				dq.push_back({a,b});
				dist[a][b] = dist[y][x] + 1;
				visited[a][b] = 1;
			}else{
				dq.push_front({a,b});
				dist[a][b] = dist[y][x];
				visited[a][b] = 1;
			}
		}
	}
	cout<<dist[end.first][end.second]<<'\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 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 2 ms 856 KB Output is correct
20 Correct 2 ms 856 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
22 Correct 3 ms 1080 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 3 ms 984 KB Output is correct
27 Correct 3 ms 1116 KB Output is correct
28 Correct 2 ms 1112 KB Output is correct
29 Correct 5 ms 1992 KB Output is correct
30 Correct 3 ms 984 KB Output is correct
31 Correct 4 ms 2904 KB Output is correct
32 Correct 6 ms 1884 KB Output is correct
33 Correct 5 ms 1880 KB Output is correct
34 Correct 4 ms 1892 KB Output is correct
35 Correct 5 ms 2024 KB Output is correct
36 Correct 7 ms 2140 KB Output is correct
37 Correct 7 ms 2140 KB Output is correct
38 Correct 5 ms 1884 KB Output is correct
39 Correct 68 ms 16604 KB Output is correct
40 Correct 7 ms 2140 KB Output is correct
41 Correct 7 ms 2396 KB Output is correct
42 Correct 8 ms 2648 KB Output is correct
43 Correct 8 ms 2908 KB Output is correct
44 Correct 26 ms 8280 KB Output is correct
45 Correct 30 ms 9056 KB Output is correct
46 Correct 63 ms 29248 KB Output is correct
47 Correct 59 ms 16452 KB Output is correct
48 Correct 55 ms 16476 KB Output is correct
49 Correct 35 ms 16744 KB Output is correct
50 Correct 59 ms 16476 KB Output is correct
51 Correct 60 ms 16980 KB Output is correct
52 Correct 69 ms 16728 KB Output is correct
53 Correct 67 ms 16612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 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 2 ms 856 KB Output is correct
20 Correct 2 ms 856 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
22 Correct 3 ms 1080 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 3 ms 984 KB Output is correct
27 Correct 3 ms 1116 KB Output is correct
28 Correct 2 ms 1112 KB Output is correct
29 Correct 5 ms 1992 KB Output is correct
30 Correct 3 ms 984 KB Output is correct
31 Correct 4 ms 2904 KB Output is correct
32 Correct 6 ms 1884 KB Output is correct
33 Correct 5 ms 1880 KB Output is correct
34 Correct 4 ms 1892 KB Output is correct
35 Correct 5 ms 2024 KB Output is correct
36 Correct 7 ms 2140 KB Output is correct
37 Correct 7 ms 2140 KB Output is correct
38 Correct 5 ms 1884 KB Output is correct
39 Correct 68 ms 16604 KB Output is correct
40 Correct 7 ms 2140 KB Output is correct
41 Correct 7 ms 2396 KB Output is correct
42 Correct 8 ms 2648 KB Output is correct
43 Correct 8 ms 2908 KB Output is correct
44 Correct 26 ms 8280 KB Output is correct
45 Correct 30 ms 9056 KB Output is correct
46 Correct 63 ms 29248 KB Output is correct
47 Correct 59 ms 16452 KB Output is correct
48 Correct 55 ms 16476 KB Output is correct
49 Correct 35 ms 16744 KB Output is correct
50 Correct 59 ms 16476 KB Output is correct
51 Correct 60 ms 16980 KB Output is correct
52 Correct 69 ms 16728 KB Output is correct
53 Correct 67 ms 16612 KB Output is correct
54 Incorrect 1 ms 348 KB Output isn't correct
55 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 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 2 ms 856 KB Output is correct
20 Correct 2 ms 856 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
22 Correct 3 ms 1080 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 3 ms 984 KB Output is correct
27 Correct 3 ms 1116 KB Output is correct
28 Correct 2 ms 1112 KB Output is correct
29 Correct 5 ms 1992 KB Output is correct
30 Correct 3 ms 984 KB Output is correct
31 Correct 4 ms 2904 KB Output is correct
32 Correct 6 ms 1884 KB Output is correct
33 Correct 5 ms 1880 KB Output is correct
34 Correct 4 ms 1892 KB Output is correct
35 Correct 5 ms 2024 KB Output is correct
36 Correct 7 ms 2140 KB Output is correct
37 Correct 7 ms 2140 KB Output is correct
38 Correct 5 ms 1884 KB Output is correct
39 Correct 68 ms 16604 KB Output is correct
40 Correct 7 ms 2140 KB Output is correct
41 Correct 7 ms 2396 KB Output is correct
42 Correct 8 ms 2648 KB Output is correct
43 Correct 8 ms 2908 KB Output is correct
44 Correct 26 ms 8280 KB Output is correct
45 Correct 30 ms 9056 KB Output is correct
46 Correct 63 ms 29248 KB Output is correct
47 Correct 59 ms 16452 KB Output is correct
48 Correct 55 ms 16476 KB Output is correct
49 Correct 35 ms 16744 KB Output is correct
50 Correct 59 ms 16476 KB Output is correct
51 Correct 60 ms 16980 KB Output is correct
52 Correct 69 ms 16728 KB Output is correct
53 Correct 67 ms 16612 KB Output is correct
54 Incorrect 1 ms 348 KB Output isn't correct
55 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 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 2 ms 856 KB Output is correct
20 Correct 2 ms 856 KB Output is correct
21 Correct 2 ms 1372 KB Output is correct
22 Correct 3 ms 1080 KB Output is correct
23 Correct 3 ms 860 KB Output is correct
24 Correct 2 ms 860 KB Output is correct
25 Correct 2 ms 860 KB Output is correct
26 Correct 3 ms 984 KB Output is correct
27 Correct 3 ms 1116 KB Output is correct
28 Correct 2 ms 1112 KB Output is correct
29 Correct 5 ms 1992 KB Output is correct
30 Correct 3 ms 984 KB Output is correct
31 Correct 4 ms 2904 KB Output is correct
32 Correct 6 ms 1884 KB Output is correct
33 Correct 5 ms 1880 KB Output is correct
34 Correct 4 ms 1892 KB Output is correct
35 Correct 5 ms 2024 KB Output is correct
36 Correct 7 ms 2140 KB Output is correct
37 Correct 7 ms 2140 KB Output is correct
38 Correct 5 ms 1884 KB Output is correct
39 Correct 68 ms 16604 KB Output is correct
40 Correct 7 ms 2140 KB Output is correct
41 Correct 7 ms 2396 KB Output is correct
42 Correct 8 ms 2648 KB Output is correct
43 Correct 8 ms 2908 KB Output is correct
44 Correct 26 ms 8280 KB Output is correct
45 Correct 30 ms 9056 KB Output is correct
46 Correct 63 ms 29248 KB Output is correct
47 Correct 59 ms 16452 KB Output is correct
48 Correct 55 ms 16476 KB Output is correct
49 Correct 35 ms 16744 KB Output is correct
50 Correct 59 ms 16476 KB Output is correct
51 Correct 60 ms 16980 KB Output is correct
52 Correct 69 ms 16728 KB Output is correct
53 Correct 67 ms 16612 KB Output is correct
54 Incorrect 1 ms 348 KB Output isn't correct
55 Halted 0 ms 0 KB -