-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5_3.cpp
74 lines (59 loc) · 1.15 KB
/
5_3.cpp
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
#include <bits/stdc++.h>
using namespace std;
const int Maxn = 300;
int n, m;
int upper[Maxn][Maxn];
int torig[Maxn][Maxn];
int Ans[Maxn][Maxn];
void Dp()
{
Ans[1][1] = 1;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
if (upper[i][j] != -1)
Ans[i + 1][j] += Ans[i][j];
if (torig[i][j] != -1)
Ans[i][j + 1] += Ans[i][j];
}
}
printf("%d\n", Ans[n][m]);
}
void Solve()
{
scanf("%d%d", &n, &m);
n++, m++;
int ope;
scanf("%d", &ope);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
upper[i][j] = i + 1;
torig[i][j] = j + 1;
}
}
for (int i = 1; i <= ope; i++)
{
int x, y, R, L;
scanf("%d%d%d%d", &x, &y, &R, &L);
for (int k = y; k < y + L; k++)
for (int j = x + 1; j < x + R; j++)
torig[j][k] = -1;
for (int j = x; j < x + R; j++)
for (int k = y + 1; k < y + L; k++)
upper[j][k] = -1;
Dp();
}
}
int main()
{
Solve();
return 0;
}
/*
5 6
1
2 4 3 2
*/