Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 90d8f0d

Browse files
accepted
1 parent 7df3bcd commit 90d8f0d

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#include <iostream>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
int main() {
7+
vector<vector<int> > grid(11, vector<int>(11, 0));
8+
9+
int n, d, l, r, c, no = 0, nono = 0;
10+
11+
cin >> n;
12+
13+
while(n--) {
14+
cin >> d >> l >> r >> c;
15+
16+
if (d == 0) {
17+
if (c + l - 1 > 10) {
18+
no = 1;
19+
20+
} else {
21+
for (int i = c; i <= c+l-1; i++) {
22+
if (grid[r][i] == 1) {
23+
no = 1;
24+
break;
25+
}
26+
grid[r][i] = 1;
27+
}
28+
}
29+
} else {
30+
if (r + l - 1 > 10) {
31+
no = 1;
32+
} else {
33+
for (int i = r; i <= r+l-1; i++) {
34+
if (grid[i][c] == 1) {
35+
no = 1;
36+
break;
37+
}
38+
grid[i][c] = 1;
39+
}
40+
}
41+
42+
}
43+
44+
if (no == 1) {
45+
nono = 1;
46+
}
47+
}
48+
49+
50+
if (no) {
51+
cout << "N\n";
52+
} else {
53+
cout << "Y\n";
54+
}
55+
return 0;
56+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /