Submission #773814

#TimeUsernameProblemLanguageResultExecution timeMemory
773814t6twotwoPacking Biscuits (IOI20_biscuits)C++17
21 / 100
1068 ms340 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll count_tastiness(ll q, vector<ll> A) { A.resize(61); if (q == 1) { map<ll, ll> mp; mp[0] = 1; for (int i = 0; i < A.size(); i++) { map<ll, ll> t; for (auto [add, x] : mp) { t[(A[i] + add) / 2] += x; if (A[i] + add >= q) { t[(A[i] + add - q) / 2] += x; } } swap(mp, t); } ll ans = 0; for (auto [_, x] : mp) { ans += x; } return ans; } int ans = 0; for (ll i = 0; i <= 100000; i++) { auto B = A; ans++; for (int j = 0; j < 60; j++) { if (i >> j & 1) { if (B[j] < q) { ans--; break; } B[j] -= q; } B[j + 1] += B[j] / 2; } } return ans; }

Compilation message (stderr)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:10:27: 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++) {
      |                         ~~^~~~~~~~~~
#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...