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

#TimeUsernameProblemLanguageResultExecution timeMemory
614186penguinhackerPacking Biscuits (IOI20_biscuits)C++17
100 / 100
23 ms1364 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ar array ll count_tastiness(ll x, vector<ll> a) { vector<ll> v(60); for (int i=0; i<a.size(); ++i) v[i]+=(1ll*a[i])<<i; for (int i=1; i<60; ++i) v[i]+=v[i-1]; for (int i=0; i<60; ++i) v[i]=min(v[i]/x, (1ll<<i+1)-1); vector<vector<ll>> dp(60, vector<ll>(60)); for (int i=0; i<60; ++i) { for (int j=i; j<60; ++j) { ll mask=v[j]&((1ll<<i+1)-1); if (!i) { dp[i][j]=mask+1; continue; } if (mask&1ll<<i) dp[i][j]=dp[i-1][i-1]+dp[i-1][mask-(1ll<<i)<=v[i-1]?j:i-1]; else dp[i][j]=dp[i-1][mask<=v[i-1]?j:i-1]; } } return dp[59][59]; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:10:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for (int i=0; i<a.size(); ++i)
      |                ~^~~~~~~~~
biscuits.cpp:15:27: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   15 |   v[i]=min(v[i]/x, (1ll<<i+1)-1);
      |                          ~^~
biscuits.cpp:19:25: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   19 |    ll mask=v[j]&((1ll<<i+1)-1);
      |                        ~^~
#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...