Submission #834130

#TimeUsernameProblemLanguageResultExecution timeMemory
834130farukPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1012 ms340 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define all(a) a.begin(), a.end() using namespace std; typedef long long ll; const ll maxsum = 1e5+1; const ll maxsiz = 71; long long count_tastiness(long long x, std::vector<long long> a) { if (x == 1) { ll out = 1; a.resize(maxsiz); for (int i = 0; i < a.size()-1; i++) { int to_remove = 0; if (a[i] % 2) to_remove = a[i] - 1; else if (a[i] > 0) to_remove = a[i] - 2; a[i + 1] += to_remove / 2; a[i] -= to_remove; } ll has_l = 0, hasnt_l = 1; for (int i = 0; i < a.size(); i++) { if (a[i] == 0) { out *= has_l + hasnt_l; has_l = 0, hasnt_l = 1; } else { has_l *= 2; if (a[i] == 2) has_l++; hasnt_l *= 2; } } return out; } //x = 1; ll out = 0; a.resize(61); for (int val = 0; val < maxsum; val++) { vector<ll> curr = a; int num = 0; bool ok = true; for (ll a = 0; a < curr.size(); a++) { num += curr[a]; if ((val & (1LL <<a)) != 0) { if (num < x) ok = false; else num -= x; } num /= 2; } if (ok) out++; } return out; }

Compilation message (stderr)

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