Submission #805906

#TimeUsernameProblemLanguageResultExecution timeMemory
805906LittleCubePacking Biscuits (IOI20_biscuits)C++17
44 / 100
1133 ms1235700 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define ll long long using namespace std; long long count_tastiness(ll x, vector<ll> a) { a.resize(60); int k = 60; vector<ll> sum(k), fold(k); sum[0] = a[0]; for (int i = 1; i < k; i++) sum[i] = sum[i - 1] + (a[i] << i); for (int i = 0; i < k; i++) if (sum[i] / x / (1LL << i) == 0) fold[i] = -1; else fold[i] = min((1LL << i) - 1, (sum[i] - x * (1LL << i)) / x); vector<ll> v; v.reserve(400000); v.emplace_back(0); for (int i = 0; i < k; i++) { for (int j = 0; j < v.size(); j++) if(v[j] <= fold[i]) v.emplace_back((1LL << i) + v[j]); else break; } return v.size(); }

Compilation message (stderr)

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