Submission #432310

#TimeUsernameProblemLanguageResultExecution timeMemory
432310MlxaPacking Biscuits (IOI20_biscuits)C++14
9 / 100
1081 ms332 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define mp make_pair #define mt make_tuple #define x first #define y second #include "biscuits.h" bool bit(ll m, int i) { return (m >> i) & 1; } ll count_tastiness(ll x, vector<ll> a) { auto check = [&](ll y) { vector<ll> b = a; b.resize(61, 0); for (int k = 60; k >= 0; --k) { if (!bit(y, k)) { continue; } for (ll it = x; it--; ) { ll need = 1; for (int pos = k; pos >= 0 && need; --pos) { ll delta = min(need, b[pos]); b[pos] -= delta; need -= delta; need *= 2; } if (need) { return false; } } } return true; }; ll sum = 0; for (int i = 0; i < (int)a.size(); ++i) { sum += a[i] << i; } ll answer = 0; for (ll y = 0; x * y <= sum; ++y) { if (check(y)) { ++answer; } } return answer; } #ifdef LC #include "grader.cpp" #endif
#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...