Submission #921390

# Submission time Handle Problem Language Result Execution time Memory
921390 2024-02-03T18:32:05 Z ksujay2 Packing Biscuits (IOI20_biscuits) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll count_tastiness(ll x, vector<ll> a) {
    a.resize(20);
    function<ll(int, ll)> f = [&] (int i, ll y) {
        if(i < 0) return (ll)(y == 0);
        y -= a[i] * (1LL << i);
        return f(i - 1, max(0ll, y)) + (x > (1LL << (60 - i))) ? (f(i - 1, max(0ll, y + x * (1LL << i)))  : 0);
    };
    return f(19, 0);
}

Compilation message

biscuits.cpp: In lambda function:
biscuits.cpp:10:105: error: expected ')' before ':' token
   10 |         return f(i - 1, max(0ll, y)) + (x > (1LL << (60 - i))) ? (f(i - 1, max(0ll, y + x * (1LL << i)))  : 0);
      |                                                                  ~                                      ^ ~
      |                                                                                                         )
biscuits.cpp:10:111: error: expected ':' before ';' token
   10 |         return f(i - 1, max(0ll, y)) + (x > (1LL << (60 - i))) ? (f(i - 1, max(0ll, y + x * (1LL << i)))  : 0);
      |                                                                                                               ^
      |                                                                                                               :
biscuits.cpp:10:111: error: expected primary-expression before ';' token