Submission #1070977

#TimeUsernameProblemLanguageResultExecution timeMemory
1070977mariaclaraPacking Biscuits (IOI20_biscuits)C++17
9 / 100
1140 ms2069344 KiB
#include "biscuits.h" #include<vector> #pragma GCC optimize("Ofast") using namespace std; typedef long long ll; #define sz(x) (int)x.size() #define pb push_back ll count_tastiness(ll x, vector<ll> a) { int n = 60; while(sz(a) < 60) a.pb(0); for(int i = 0; i < n-1; i++) { if(a[i] < x) continue; a[i+1] += (a[i] - x)/2; a[i] = x + ((a[i] - x)%2); } vector<ll> dp; dp.pb(0); ll to_add = 0, aux = x; for(int i = 0; i < n and aux < 1e18; i++, aux *= 2) { // (val + to_add)/2^i >= x // val >= (x << i) - to_add to_add += (a[i] << i); ll val = to_add - aux; int m = sz(dp); for(int j = 0; j < m and dp[j] <= val; j++) { // dp[i][j] = guarda quantos números eu posso formar dp.pb(aux + dp[j]); } } return sz(dp); }
#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...