-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathH.cpp
More file actions
83 lines (73 loc) 路 1.92 KB
/
Copy pathH.cpp
File metadata and controls
83 lines (73 loc) 路 1.92 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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pl pair<ll, ll>
#define vl vector<long long>
#define vp vector<pl>
#define vs vector<string>
#define vvl vector<vl>
#define sl set<ll>
#define ml map<ll, ll>
#define MAXHeap priority_queue<ll>
#define MINHeap priority_queue<ll, vector<ll>, greater<ll>>
ll mod = 1e9 + 7;
ll MAX = 1e9;
#define rep(i,a,b) for(ll i = a;i < b;i++)
#define rev(i,a,b) for(ll i = a;i >= b;i--)
#define pb push_back
#define po pop_back
#define mp make_pair
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define F first
#define S second
#define mset(m, v) memset(m, v, sizeof(m))
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a * b) / gcd(a, b))
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define vin(v) rep(i, 0, v.size()) cin >> v[i]
#define vout(v) rep(i, 0, v.size()) cout << v[i] << " "; cout << endl;
#define all(o) (o).begin(), (o).end()
#define asort(o) sort((o).begin(), (o).end())
#define dsort(o) sort((o).rbegin(), (o).rend())
#define maxin(a) *max_element(a.begin(), a.end())
#define minin(a) *min_element(a.begin(), a.end())
#define ub_index(v, x) (ub(all(v), x) - v.begin())
#define lb_index(v, x) (lb(all(v), x) - v.begin())
ll DP[1000][1000];
void solve() {
ll n, m, ans = 0;
cin >> m >> n;
vs v(m);
vin(v);
ll x = 1, y = 1;
for (int i = 0; i < m; i++)
{
if (v[i][0] == '#') x = 0;
DP[i][0] = x;
}
for (int j = 0; j < n; j++)
{
if (v[0][j] == '#') y = 0;
DP[0][j] = y;
}
for (int i = 1; i < m; i++)
{
for (int j = 1; j < n; j++)
{
if (v[i][j] == '#') DP[i][j] = 0;
else DP[i][j] = (DP[i - 1][j] + DP[i][j - 1]) % mod;
}
}
cout << DP[m-1][n-1] << endl;
return;
}
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
ll t = 1;
// cin >> t;
while (t--) solve();
return 0;
}