#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())
typedef long long ll;
using namespace std;
const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;
int n, m, a[1000][1000], d[1000][1000][20], z, k, t, x, y, sum;
int main () {
ios_base::sync_with_stdio(false); cin.tie(0);
// freopen(fname".in", "r", stdin);
//freopen(fname".out", "w", stdout);
cin >> n >> m >> k >> t >> z;
for (int i = 1; i <= k; ++i) {
cin >> x >> y;
//scanf("%lld%lld", &x, &y);
a[x][y] = 1;
}
d[0][0][0] = 1;
for (int i = 0; i <= n; ++i) {
for (int j = 0; j <= m; ++j) {
if (i == 0 && j == 0) continue;
if (a[i][j] == 1) {
for (int q = 1; q <= k; ++q) {
d[i][j][q] = (d[i - 1][j][q - 1] + d[i][j][q]) % z;
d[i][j][q] = (d[i][j - 1][q - 1] + d[i][j][q]) % z;
}
}else {
for (int q = 0; q <= k; ++q) {
d[i][j][q] = (d[i - 1][j][q] + d[i][j][q]) % z;
d[i][j][q] = (d[i][j - 1][q] + d[i][j][q]) % z;
}
}
}
}
for (int i = 0; i <= t; ++i) {
sum += d[n][m][i];
sum %= z;
}
cout << sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
7 ms |
548 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
7 ms |
508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
7 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
7 ms |
732 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
7 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
7 ms |
476 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
6 ms |
508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
6 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |