-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaoj2000.cpp.bak
More file actions
85 lines (81 loc) · 1.67 KB
/
aoj2000.cpp.bak
File metadata and controls
85 lines (81 loc) · 1.67 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <cstring>
#include <cctype>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <complex>
using namespace std;
int main() {
int N, M, x, y;
pair<int, int> robot;
int field[21][21];
while(cin >> N, N) {
for(int i=0; i<21; i++)
for(int j=0; j<21; j++)
field[i][j] = 0;
robot.first = robot.second = 10;
for(int i=0; i<N; i++) {
cin >> x >> y;
field[x][y] = 1;
}
for(int i=0; i<21; i++) {
for(int j=0; j<21; j++)
cout << field[j][i] << ' ';
cout << endl;
}
cin >> M;
for(int j=0; j<M; j++) {
char drct;
int dis;
cin >> drct >> dis;
if(drct == 'N') {
for(int i=robot.second+1; i<=robot.second+dis; i++) {
field[robot.first][i] = 0;
}
robot.second += dis;
}
else if(drct == 'E') {
for(int i=robot.first+1; i<=robot.first+dis; i++) {
field[i][robot.second] = 0;
}
robot.first += dis;
}
else if(drct == 'S') {
for(int i=robot.second-dis+1; i<=robot.second; i++) {
field[robot.first][i] = 0;
}
robot.second -= dis;
}
else if(drct == 'W') {
for(int i=robot.first-dis+1; i<=robot.first; i++) {
field[i][robot.second] = 0;
}
robot.first -= dis;
}
}
for(int i=0; i<21; i++) {
for(int j=0; j<21; j++)
cout << field[j][i] << ' ';
cout << endl;
}
int check = 0;
for(int i=0; i<21; i++)
for(int j=0; j<21; j++)
check += field[i][j];
if(check) cout << "No" << endl;
else cout << "Yes" << endl;
}
return 0;
}