-
Notifications
You must be signed in to change notification settings - Fork 0
/
Maze.c
49 lines (36 loc) · 882 Bytes
/
Maze.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/stdc++.h>
using namespace std;
const int di[] = { -1 , 0 , 1 , 0};
const int dj[] = {0, 1 , 0 ,-1};
struct GRAPH{
int i , j;
};
int a[160][160];
queue <GRAPH> qu;
int disst[160][160], disen[160][160];
int main(){
int r,c;
int sti, sij;
int eni,enj;
int i , j ,k ;
scanf("%d %d", &r ,&c);
scanf("%d %d", &sti, &stj);
scanf("%d %d", &eni , &enj);
for(i = 1 ; i <= r ; i++){
for(j = 1 ; j <= c ; j++){
scanf("%d", &a[i][j]);
}
}
memset(disst , -1 , sizeof(disst));
disst[sti][stj] = 1;
qu.push({sti,stj});
while(qu.empty() == 0){
int i = qu.front().i;
int j = qu.front().j;
qu.pop();
for(k = 0 ; k < 4 ; k++){
int ii = i + di[k];
int jj = j + dj[k];
}
}
}