Submission #624097

#TimeUsernameProblemLanguageResultExecution timeMemory
624097PlurmPacking Biscuits (IOI20_biscuits)C++17
0 / 100
2 ms340 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x, vector<long long> a) { for (int i = 0; i < a.size(); i++) { if (a[i] <= 2ll) continue; if (a[i] % 2ll == 0ll) { long long d = (a[i] - 2ll) / 2ll; a[i] -= 2ll * d; if (i == a.size() - 1) a.push_back(d); else a[i + 1] += d; } else if (a[i] % 2ll == 1ll) { long long d = (a[i] - 1ll) / 2ll; a[i] -= 2ll * d; if (i == a.size() - 1) a.push_back(d); else a[i + 1] += d; } } int k = a.size(); for (int i = k - 1; i > 0; i--) { if (a[i - 1] > 0ll) { a[i - 1] += a[i] * 2ll; a[i] = 0ll; } } long long ans = 1ll; for (int i = 0; i < k; i++) if (a[i]) ans *= 1ll * a[i]; return ans; }

Compilation message (stderr)

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