#include <bits/stdc++.h>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 200005
#define MOD ll(998244353)
using namespace std;
typedef long long ll;
int dp[301][301][301], a[301][301];
int main()
{
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m, k;
cin >> n >> m >> k;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) cin >> a[i][j];
dp[0][0][min(k, a[0][0])] = 1;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
for (int u = 0; u <= k; u++)
{
if (dp[i][j][u] == 0) continue;
if (i + 1 != n) dp[i + 1][j][min(k, u * a[i + 1][j])] = (dp[i + 1][j][min(k, u * a[i + 1][j])] + dp[i][j][u]) % MOD;
if (j + 1 != m) dp[i][j + 1][min(k, u * a[i][j + 1])] = (dp[i][j + 1][min(k, u * a[i][j + 1])] + dp[i][j][u]) % MOD;
}
cout << dp[n - 1][m - 1][k];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
185 ms |
65536 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Runtime error |
191 ms |
65540 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Execution timed out |
6072 ms |
6544 KB |
Time limit exceeded |
4 |
Execution timed out |
6037 ms |
6980 KB |
Time limit exceeded |
5 |
Runtime error |
39 ms |
9464 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
5438 ms |
13308 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
70 ms |
8696 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Execution timed out |
6095 ms |
5748 KB |
Time limit exceeded |
9 |
Runtime error |
273 ms |
9976 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
857 ms |
10272 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |