#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ft first
#define sd second
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
const ll N = 310;
const ll md = ll(1e9) + 7;
ll f[N][N][N], r, c, n, a[N][N];
void SUM(ll &x, ll y){
x += y;
if (x >= md)
x -= md;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> r >> c >> n;
assert(n <= 300);
for (ll i = 1; i <= r; i++)
for (ll j = 1; j <= c; j++)
cin >> a[i][j];
f[1][1][min(a[1][1], n)] = 1;
for (ll i = 1; i <= r; i++)
for (ll j = 1; j <= c; j++)
for (ll k = 1; k <= n; k++){
if (f[i][j][k] == 0) continue;
if (i + 1 <= r)
SUM(f[i + 1][j][min(n, k * a[i + 1][j])], f[i][j][k]);
if (j + 1 <= c)
SUM(f[i][j + 1][min(n, k * a[i][j + 1])], f[i][j][k]);
}
cout << f[r][c][n];
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
121 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Runtime error |
116 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Runtime error |
15 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
15 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
15 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
15 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
14 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
16 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
15 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
15 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |