Submission #466012

#TimeUsernameProblemLanguageResultExecution timeMemory
466012bluePacking Biscuits (IOI20_biscuits)C++17
Compilation error
0 ms0 KiB
#include "biscuits.h" #include <vector> using namespace std; //x = number of people (p) //y = tastiness of each bag (i) long long count_tastiness(long long x, vector<long long> a) { int k = a.size(); long long ans = 0; long long a_sum = 0; for(int i = 0; i < k; i++) a_sum += a[i] * (1 << i); if(x > a_sum) return 1; for(long long y = 0; x*y <= a_sum; y++) { vector<long long> value(x, 0); vector<long long> A = a; for(int i = k-1; i >= 0; i--) { for(int p = 0; p < x; p++) { int G = min(A[i], (y - value[p])/(1 << i)); value[p] += (1 << i)*G; A[i] -= G; } } bool good = 1; for(int p = 0; p < x; p++) if(value[p] != y) good = 0; if(good) ans++; } return ans; } #include "biscuits.h" #include <vector> using namespace std; //x = number of people (p) //y = tastiness of each bag (i) long long count_tastiness(long long x, vector<long long> a) { int k = a.size(); long long ans = 0; long long a_sum = 0; for(int i = 0; i < k; i++) a_sum += a[i] * (1 << i); if(x > a_sum) return 1; for(long long y = 0; x*y <= a_sum; y++) { vector<long long> value(x, 0); vector<long long> A = a; for(int i = k-1; i >= 0; i--) { for(int p = 0; p < x; p++) { int G = min(A[i], (y - value[p])/(1 << i)); value[p] += (1 << i)*G; A[i] -= G; } } bool good = 1; for(int p = 0; p < x; p++) if(value[p] != y) good = 0; if(good) ans++; } return ans; }

Compilation message (stderr)

biscuits.cpp:54:11: error: redefinition of 'long long int count_tastiness(long long int, std::vector<long long int>)'
   54 | long long count_tastiness(long long x, vector<long long> a)
      |           ^~~~~~~~~~~~~~~
biscuits.cpp:8:11: note: 'long long int count_tastiness(long long int, std::vector<long long int>)' previously defined here
    8 | long long count_tastiness(long long x, vector<long long> a)
      |           ^~~~~~~~~~~~~~~