(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 #305573

#TimeUsernameProblemLanguageResultExecution timeMemory
305573emanIaicepsaPacking Biscuits (IOI20_biscuits)C++17
100 / 100
92 ms1144 KiB
#include "biscuits.h" #include<bits/stdc++.h> #define ll long long using namespace std; ll arr[65], lim[65], X; map<ll, ll> dp[65]; ll calc(ll i, ll j){ j = min(j, 2*X); if(dp[i][j]) return dp[i][j]; if(j >= X){ if(i > 0) dp[i][j] += calc(i-1, min(lim[i], j-X) * 2 + arr[i-1]); else dp[i][j]++; } if(i > 0) dp[i][j] += calc(i-1, min(lim[i], j) * 2 + arr[i-1]); else dp[i][j]++; return dp[i][j]; } ll count_tastiness(long long x, std::vector<long long> a) { memset(arr, 0, sizeof(arr)); memset(lim, 0, sizeof(lim)); for(int i=0;i<63;i++) dp[i].clear(); X = x; for(int i=0;i<a.size();i++) arr[i] = a[i]; for(int i=0;i<62;i++) lim[i+1] = arr[i]/2, arr[i+1] += arr[i]/2, arr[i] %= 2; return calc(62, arr[62]); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:26:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int i=0;i<a.size();i++) arr[i] = a[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...