-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathants.cpp
More file actions
69 lines (65 loc) · 1.99 KB
/
Copy pathants.cpp
File metadata and controls
69 lines (65 loc) · 1.99 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <bits/stdc++.h>
using namespace std ;
// 1: U, 2:D, 3:L, 4:R, 5:Anteater
bool finish(bool *x, int R, int C) {
for (int i=0; i<R; ++i)
for (int j = 0; j < C; ++j)
for (int k = 0; k < 4; ++k)
if (*(x + 5*(i*C+j) + k))
return false ;
return true ;
}
int main(){
int T ;
cin >> T ;
char temp ;
for(int i=0; i<T; ++i){
int R, C ;
cin >> R >> C ;
int anteaters = 0 ;
bool arr[R][C][5];
for(int i=0; i<R; ++i)
for(int j=0; j<C; ++j) {
cin >> temp ;
switch (temp){
case 'U':
arr[i][j][0]=1 ;
break;
case 'D':
arr[i][j][1]=1 ;
break ;
case 'L':
arr[i][j][2]=1 ;
break ;
case 'R':
arr[i][j][3]=1 ;
break;
case '#':
arr[i][j][4]=1 ;
anteaters++ ;
}
}
while(~finish(arr[0][0], R, C)){
// Transform the bool arrar
for (int i=0; i<R; ++i)
for (int j = 0; j < C; ++j)
for (int k = 0; k < 5; ++k) {
if (arr[i][j][k]) {
switch (k) {
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
1;
}
arr[i][j][k] = 0 ;
}
}
}
}
};