Pagini recente » Cod sursa (job #2805800) | Cod sursa (job #1561824) | Cod sursa (job #2796472) | Cod sursa (job #2684871) | Cod sursa (job #2839265)
#include <bits/stdc++.h>
#define int long long
using namespace std;
#ifdef LOCAL
ifstream in("in.in");
ofstream out("out.out");
#else
ifstream in("in.in");
ofstream out("out.out");
#endif
const int nmax = 5005,mod = 2000003;
int n, m, dp[nmax][nmax],c, v[nmax][nmax];
int32_t main() {
in >> n >> m >> c;
for (int i = 1; i <= c; i++) {
int y, x;
in >> y >> x;
v[y][x] = 1;
}
dp[1][1] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
if ((i == 1 && j == 1) || (v[i][j] == 1)) continue;
dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
}
}
out << dp[n][m] << "\n";
}