Submission #996303

#TimeUsernameProblemLanguageResultExecution timeMemory
996303Essa2006Packing Biscuits (IOI20_biscuits)C++14
9 / 100
100 ms412 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define FF first #define SS second #define all(a) a.begin(), aa.end() #define mod (ll)(1000000007) ll count_tastiness(ll n, vector<ll> Freq) { int sum = 100000 / n; int ans = 0; for (int i = 0; i <= sum; i++) { vector<ll> Freq2 = Freq; while(Freq2.size() < 18) { Freq2.push_back(0); } int j = 0; bool cant = 0; while (j < 18) { if ((1 << j) & i) { if (Freq2[j] < n) { cant = 1; break; } Freq2[j] -= n; } if (j != Freq2.size() - 1) { Freq2[j + 1] += Freq2[j] / 2; } j++; } ans += !cant; } return ans; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:28:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             if (j != Freq2.size() - 1) {
      |                 ~~^~~~~~~~~~~~~~~~~~~
#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...