(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #480098

#TimeUsernameProblemLanguageResultExecution timeMemory
480098couplefirePacking Biscuits (IOI20_biscuits)C++17
100 / 100
59 ms844 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int K = 60; map<ll, ll> d[K]; ll b[K]; ll dfs(int pos, ll bd){ bd = min(bd, b[pos]); if(bd<0) return 0; if(pos<0) return 1; if(d[pos].count(bd)) return d[pos][bd]; return d[pos][bd] = dfs(pos-1, bd)+dfs(pos-1, bd-(1ll<<pos)); } ll count_tastiness(ll x, vector<ll> c){ c.resize(K); ll cur = 0; for(int i = 0; i<K; ++i) cur += c[i]*(1ll<<i), b[i] = min(cur/x, 1ll<<i+1), d[i].clear(); return dfs(K-1, 1e18); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int dfs(int, long long int)':
biscuits.cpp:11:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   11 |     if(bd<0) return 0; if(pos<0) return 1;
      |     ^~
biscuits.cpp:11:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   11 |     if(bd<0) return 0; if(pos<0) return 1;
      |                        ^~
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:19:55: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   19 |         cur += c[i]*(1ll<<i), b[i] = min(cur/x, 1ll<<i+1), d[i].clear();
      |                                                      ~^~
#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...