Submission #837093

# Submission time Handle Problem Language Result Execution time Memory
837093 2023-08-24T22:55:03 Z azatega Packing Biscuits (IOI20_biscuits) C++17
0 / 100
1 ms 340 KB
#include <map>
#include <vector>

using namespace std;

#define ll long long

map<pair<int, ll>, ll> memo;
vector<ll> a;
ll x;

ll compute(int k, ll amount){
    if(memo.count({k, amount}) > 0)
        return memo[{k, amount}];

    if(k == a.size() - 1){
        // last one
        ll res = 1;
        if(amount >= x)
            res++;
        memo[{k, amount}] = res;
        return res;
    }

    ll res = 0;
    if(amount >= x)
        res += compute(k+1, a[k+1] + (amount - x)/2);
    res += compute(k+1, a[k+1] + amount/2);
    memo[{k, amount}] = res;
    return res;
}

long long count_tastiness(long long _x, vector<long long> _a){
    memo.clear();

    a = _a;
    x = _x;

    return compute(0, a[0]);
}

Compilation message

biscuits.cpp: In function 'long long int compute(int, long long int)':
biscuits.cpp:16:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     if(k == a.size() - 1){
      |        ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 260 KB Output isn't correct
2 Halted 0 ms 0 KB -