题目:

代码:
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define db double
using namespace std;
const ll N = 1e7;
ll n, m, dp[1010][1010], x[100010], y[100010];
bool ok(ll a, ll b) {
for (int i = 1; i <= m; i++)
if (x[i] == a && y[i] == b)
return true;
return false;
}
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> m;
for (int i = 1; i <= m; i++)
cin >> x[i] >> y[i];
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
if (ok(i, j))
dp[i][j] = 0;
else if (i == 1 && j == 1)
dp[i][j] = 1;
else if (i == 1)
dp[i][j] = dp[i][j - 1];
else if (j == 1)
dp[i][j] = dp[i - 1][j];
else
dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
}
for (int i = 1; i <= n; cout << endl, i++)
for (int j = 1; j <= n; j++)
cout << dp[i][j] << ' ';
// cout << dp[n][n] % 100003;
return 0;
}