Submission #838524

#TimeUsernameProblemLanguageResultExecution timeMemory
838524caganyanmazPacking Biscuits (IOI20_biscuits)C++17
21 / 100
302 ms22748 KiB
#include <bits/stdc++.h> #define pb push_back #define ll long long #define int long long using namespace std; //#define DEBUGGING #ifdef DEBUGGING #include "../debug.h" #else #define debug(x...) void(42) #endif int MXK = 62; ll count_tastiness(ll x, vector<ll> a) { if (x >= 1e5) return 1; if (x >= 1e4) MXK = 30; else MXK = 62; while (a.size() < MXK-1) a.pb(0); for (int i = 0; i < MXK-2; i++) { ll change = max<ll>((a[i] - x) / 2, 0); a[i+1] += change; a[i] -= change * 2; } vector<ll> pf(MXK, 0); for (int i = 1; i < MXK; i++) pf[i] = pf[i-1] + (a[i-1] << (i-1)); vector<vector<ll>> dp(MXK, vector<ll>(x+3, 0)); // Last open bit dp[0][0] = 1; for (int i = 1; i < MXK; i++) for (int j = 0; j < i; j++) for (int k = 0; k < x+3; k++) if (((pf[i] - pf[j] + (k<<(j-1)))>>(i-1)) >= x) dp[i][((pf[i]-pf[j]+(k<<(j-1)))>>(i-1))-x] += dp[j][k]; ll res = 0; for (int i = 0; i < MXK; i++) for (int j = 0; j < x + 3; j++) res += dp[i][j]; debug(dp, res); return res; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:24:18: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   24 |  while (a.size() < MXK-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...