Submission #170987

# Submission time Handle Problem Language Result Execution time Memory
170987 2019-12-26T23:55:24 Z bloopie Ice Hockey World Championship (CEOI15_bobek) C++14
40 / 100
1000 ms 97364 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 50;
unordered_map<ll,ll> memo[MAXN];
int n;
ll mm;
ll a[MAXN];

ll solve(int i,ll m)
{
if(m > mm)
     return 0;
if(i == n)
      return 1;
if(memo[i].find(m) != memo[i].end())
      return memo[i][m];

ll &ret = memo[i][m];
ret = 0;
ret = solve(i + 1 , m + a[i]) + solve(i + 1 , m);

return ret;

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> mm;
    for(int i = 0 ; i < n ; i++)
        cin >> a[i];

   cout << solve(0,0);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 4008 KB Output is correct
2 Correct 14 ms 2296 KB Output is correct
3 Correct 24 ms 3496 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 668 ms 47268 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 491 ms 36128 KB Output is correct
2 Correct 35 ms 5160 KB Output is correct
3 Correct 16 ms 2680 KB Output is correct
4 Correct 9 ms 1528 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 40 ms 6072 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 14072 KB Output is correct
2 Execution timed out 1082 ms 93424 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 212 ms 25496 KB Output is correct
2 Execution timed out 1083 ms 97364 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 85256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 86508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 80316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 97312 KB Time limit exceeded
2 Halted 0 ms 0 KB -