Submission #390681

#TimeUsernameProblemLanguageResultExecution timeMemory
390681AdOjis485Packing Biscuits (IOI20_biscuits)C++17
0 / 100
1088 ms332 KiB
#include "biscuits.h" #include <iostream> #define int long long using namespace std; int count_tastiness(int x, vector<int> a) { int ans = 0; for(int i = 0; i <= 1e5; i ++) { bool poss = true; int i2 = i; int j = 0; while(i2 > 0) { if(i2 % 2 == 1) { if(j >= a.size() || a[j] < x) { poss = false; break; } a[j] -= x; } if(j + 1 == a.size()) a.push_back(0); a[j + 1] += a[j] / 2; i2 /= 2; j ++; } ans += poss; } return ans; }

Compilation message (stderr)

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