Submission #602244

# Submission time Handle Problem Language Result Execution time Memory
602244 2022-07-22T18:52:12 Z PiejanVDC Packing Biscuits (IOI20_biscuits) C++17
Compilation error
0 ms 0 KB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

long long X;

vector<long long>v;

map<long long, long long>mp[61];

long long dp(int i, long long cnt) {
    if(i == 61)
        return 1;
    if(mp[i].count(cnt))
        return mp[i][cnt];
    long long ret = 0;
    if(cnt + v[i] >= X)
        ret = dp(i+1, (cnt + v[i] - X)/2);
    ret += dp(i+1, (cnt+v[i])/2);
    return mp[i][cnt] = ret;
}

long long count_tastiness(long long x, vector<long long>a) {
    X = x;
    v = a;
    for(int i = a.size() ; i < K ; i++)
        v.push_back(0);
    for(int i = 0 ; i < 61 ; i++)
        mp.clear();
    return dp(0, 0);
}

Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:26:32: error: 'K' was not declared in this scope
   26 |     for(int i = a.size() ; i < K ; i++)
      |                                ^
biscuits.cpp:29:12: error: request for member 'clear' in 'mp', which is of non-class type 'std::map<long long int, long long int> [61]'
   29 |         mp.clear();
      |            ^~~~~