Submission #225171

# Submission time Handle Problem Language Result Execution time Memory
225171 2020-04-19T10:49:34 Z Vimmer Mobitel (COCI19_mobitel) C++14
0 / 130
6000 ms 1152 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 100005
#define MOD ll(1e9 + 7)

using namespace std;

typedef long long ll;

typedef long double ld;



ll a[305][305], n, m, s, ans;


void rec(int x, int y, ll sm)
{
    if (x + 1 == n && y + 1 == m)
    {
        if (sm >= s) ans++;

        return;
    }

    if (x + 1 != n) rec(x + 1, y, sm * a[x + 1][y]);

    if (y + 1 != m) rec(x, y + 1, sm * a[x][y + 1]);
}


int main()
{

    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n >> m >> s;

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


    rec(0, 0, a[0][0]);

    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 6052 ms 1024 KB Time limit exceeded
2 Execution timed out 6057 ms 1152 KB Time limit exceeded
3 Execution timed out 6054 ms 512 KB Time limit exceeded
4 Execution timed out 6074 ms 512 KB Time limit exceeded
5 Execution timed out 6050 ms 512 KB Time limit exceeded
6 Execution timed out 6082 ms 512 KB Time limit exceeded
7 Execution timed out 6091 ms 512 KB Time limit exceeded
8 Execution timed out 6047 ms 896 KB Time limit exceeded
9 Execution timed out 6045 ms 1024 KB Time limit exceeded
10 Execution timed out 6044 ms 1024 KB Time limit exceeded