답안 #225010

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
225010 2020-04-19T08:00:14 Z VEGAnn Mobitel (COCI19_mobitel) C++14
26 / 130
308 ms 1408 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[2][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[0][1][min(a[1][1], n)] = 1;

    int it = 0;

    for (int i = 1; i <= r; i++) {
        for (int j = 1; j <= c; j++)
        for (int k = 1; k <= n; k++)
            f[it ^ 1][j][k] = 0;

        for (int j = 1; j <= c; j++)
        for (int k = 1; k <= n; k++){
            if (f[it][j][k] == 0) continue;

            if (i + 1 <= r)
                SUM(f[it ^ 1][j][min(n, k * a[i + 1][j])], f[it][j][k]);

            if (j + 1 <= c)
                SUM(f[it][j + 1][min(n, k * a[i][j + 1])], f[it][j][k]);
        }

        it ^= 1;
    }

    cout << f[it ^ 1][c][n];

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 290 ms 1408 KB Output is correct
2 Correct 308 ms 1408 KB Output is correct
3 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)