답안 #225209

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
225209 2020-04-19T14:48:17 Z Vimmer Mobitel (COCI19_mobitel) C++14
0 / 130
235 ms 3064 KB
#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[2][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;

    if (k > 300) exit(0);

    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 = 1; u <= k; u++)
                {
                    if (dp[0][j][u] == 0) continue;

                    if (i + 1 != n) dp[1][j][min(k, u * a[i + 1][j])] = (dp[1][j][min(k, u * a[i + 1][j])] + dp[0][j][u]) % MOD;

                    if (j + 1 != m) dp[0][j + 1][min(k, u * a[i][j + 1])] = (dp[0][j + 1][min(k, u * a[i][j + 1])] + dp[0][j][u]) % MOD;
                }

            for (int j = 0; j < m; j++)
                for (int u = 1; u <= k; u++) {dp[0][j][u] = dp[1][j][u]; dp[1][j][u] = 0;}
        }
    cout << dp[n - 1][m - 1][k];
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 219 ms 2960 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 235 ms 3064 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Incorrect 5 ms 384 KB Output isn't correct
4 Incorrect 4 ms 384 KB Output isn't correct
5 Incorrect 5 ms 384 KB Output isn't correct
6 Incorrect 5 ms 384 KB Output isn't correct
7 Incorrect 4 ms 384 KB Output isn't correct
8 Incorrect 4 ms 384 KB Output isn't correct
9 Incorrect 4 ms 384 KB Output isn't correct
10 Incorrect 4 ms 384 KB Output isn't correct