Submission #1074519

#TimeUsernameProblemLanguageResultExecution timeMemory
1074519TheQuantiXPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1067 ms348 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; using ll = long long; ll n, m, q, k, x, y, a, b, c; long long count_tastiness(long long x, vector<long long> a) { ll sum = 0; for (int i = 0; i < a.size(); i++) { sum += a[i] * (1 << i); } if (x == 1) { ll ans = 0; ll mx = 0; for (int i = 0; i < a.size(); i++) { if (mx < (1LL << i) - 1) { ans += mx; mx = 0; } mx += a[i] * (1LL << i); } ans += mx; return ans; } ll ans = 1; for (int i = 1; i <= sum / x; i++) { vector<ll> arr = a; bool fl = 1; for (int j = 0; j < x; j++) { ll e = i; for (int k = arr.size() - 1; k >= 0; k--) { ll x = min(e / (1LL << k), arr[k]); arr[k] -= x; e -= (1LL << k) * x; } if (e != 0) { fl = 0; break; } } if (fl) { // cout << i << '\n'; ans++; } } return ans; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < a.size(); i++) {
      |                     ~~^~~~~~~~~~
biscuits.cpp:17:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         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...