# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
224995 | VEGAnn | Mobitel (COCI19_mobitel) | C++14 | 207 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>
#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 int N = 310;
const int md = int(1e9) + 7;
int f[N][N][N], r, c, n, a[N][N];
void SUM(int &x, int 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 (int i = 1; i <= r; i++)
for (int j = 1; j <= c; j++)
cin >> a[i][j];
f[1][1][min(a[1][1], n)] = 1;
for (int i = 1; i <= r; i++)
for (int j = 1; j <= c; j++)
for (int 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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |