# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
225203 | Vimmer | Mobitel (COCI19_mobitel) | C++14 | 6061 ms | 65540 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
typedef long double ld;
ll dp[305][305][305], a[305][305];
int main()
{
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n, m, k;
cin >> n >> m >> k;
for (ll i = 0; i < n; i++)
for (ll j = 0; j < m; j++) cin >> a[i][j];
if (a[0][0] <= k) dp[0][0][a[0][0]] = 1; else dp[0][0][k] = 1;
for (ll i = 0; i < n; i++)
for (ll j = 0; j < m; j++)
for (ll 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];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |