Submission #224977

# Submission time Handle Problem Language Result Execution time Memory
224977 2020-04-19T07:35:36 Z kartel Mobitel (COCI19_mobitel) C++14
0 / 130
6000 ms 65540 KB
#include <bits/stdc++.h>
#define in(x) freopen(x,"r",stdin)
#define out(x) freopen(x,"w",stdout)
#define F first
#define S second
#define pb push_back
#define M ll(998244353)
#define inf ll(2e9+7)
#define N ll(505)
#define sz(x) x.size()
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("Ofast")
#define el '\n'
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree <ll, null_type, less_equal <ll>, rb_tree_tag, tree_order_statistics_node_update> os;

ll n, m, x, i, j, f[N][N][N], a[N][N], k;

ll sm(ll x, ll y) {return (x + y) % M;}

int main()
{
//    in("input.txt");
//    out("output.txt");

    ios_base::sync_with_stdio(false);
    iostream::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m >> x;
    for (i = 1; i <= n; i++)
        for (j = 1; j <= m; j++) cin >> a[i][j];

    f[1][1][min(x, a[1][1])] = 1;

    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++)
        for (k = 1; k <= x; k++)
    {
        f[i + 1][j][min(x, k * a[i + 1][j])] = sm(f[i + 1][j][min(x, k * a[i + 1][j])], f[i][j][k]);
        f[i][j + 1][min(x, k * a[i][j + 1])] = sm(f[i][j + 1][min(x, k * a[i][j + 1])], f[i][j][k]);
    }
    cout << f[n][m][x];
}
# Verdict Execution time Memory Grader output
1 Runtime error 83 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 82 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Execution timed out 6065 ms 34288 KB Time limit exceeded
4 Execution timed out 6056 ms 32928 KB Time limit exceeded
5 Execution timed out 6067 ms 30868 KB Time limit exceeded
6 Execution timed out 6098 ms 32608 KB Time limit exceeded
7 Execution timed out 6054 ms 43164 KB Time limit exceeded
8 Execution timed out 6060 ms 21168 KB Time limit exceeded
9 Execution timed out 6041 ms 18384 KB Time limit exceeded
10 Execution timed out 6068 ms 18456 KB Time limit exceeded