Submission #224992

# Submission time Handle Problem Language Result Execution time Memory
224992 2020-04-19T07:44:44 Z VEGAnn Mobitel (COCI19_mobitel) C++14
0 / 130
6000 ms 65540 KB
#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;

    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
1 Runtime error 221 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 202 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Execution timed out 6099 ms 6136 KB Time limit exceeded
4 Execution timed out 6069 ms 6776 KB Time limit exceeded
5 Runtime error 55 ms 9464 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 5840 ms 13504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 110 ms 8696 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Execution timed out 6057 ms 6024 KB Time limit exceeded
9 Runtime error 345 ms 10232 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 981 ms 10496 KB Execution killed with signal 11 (could be triggered by violating memory limits)