Submission #1253946

#TimeUsernameProblemLanguageResultExecution timeMemory
1253946antonn비스킷 담기 (IOI20_biscuits)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; template<typename T> bool assign_min(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<typename T> bool assign_max(T& a, T b) { if (a < b) { a = b; return true; } return false; } ll count_tastiness(ll x, vector<ll> a) { while (a.size() < 62) { a.push_back(0); } vector<ll> pref(62); for (int i = 0; i < 62; i++) { pref[i] = (i == 0 ? 0 : pref[i - 1]) + (a[i] << i); } map<ll, ll> f; auto solve = [&](auto self, ll n) { if (f.count(n)) { return f[n]; } if (n <= 0) { return 0; } ll b = __lg(n - 1); ll ans = self(self, (1LL << b)) + self(self, min(n, 1 + pref[b] / x) - (1LL << b)); return f[n] = ans; }; f[0] = 0; f[1] = 1; return solve(solve, 1e18); }

Compilation message (stderr)

biscuits.cpp: In instantiation of 'count_tastiness(ll, std::vector<long long int>)::<lambda(auto:47, ll)> [with auto:47 = count_tastiness(ll, std::vector<long long int>)::<lambda(auto:47, ll)>; ll = long long int]':
biscuits.cpp:49:17:   required from here
biscuits.cpp:41:20: error: inconsistent types 'long long int' and 'int' deduced for lambda return type
   41 |             return 0;
      |                    ^