Submission #602144

#TimeUsernameProblemLanguageResultExecution timeMemory
602144definitelynotmeePacking Biscuits (IOI20_biscuits)C++17
42 / 100
1082 ms43464 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define all(x) x.begin(), x.end() using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; template<typename T> using matrix = vector<vector<T>>; const int MAXN = 123; long long count_tastiness(long long x, std::vector<long long> a) { vector<ll> ct(MAXN); for(int i = 0; i < a.size(); i++) ct[i] = a[i]; vector<unordered_map<ll,ll>> state(MAXN); auto solve=[&](int id, ll extra, auto solve)->ll{ if(id == MAXN) return 1; if(state[id].count(extra)) return state[id][extra]; ll resp = solve(id+1,(ct[id]+extra)/2,solve); if(ct[id]+extra >=x) resp+=solve(id+1,(ct[id]+extra-x)/2,solve); state[id][extra] = resp; return resp; }; return solve(0,0,solve); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i = 0; i < a.size(); i++)
      |                    ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...