Submission #1033447

#TimeUsernameProblemLanguageResultExecution timeMemory
1033447ZicrusPacking Biscuits (IOI20_biscuits)C++17
12 / 100
2 ms600 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; typedef long long ll; ll count_tastiness(ll x, vector<ll> a) { for (int i = 0; i < a.size(); i++) { ll transfer = max(0ll, (a[i]-1) / 2); if (transfer > 0) { if (i+1 >= a.size()) a.push_back(transfer); else a[i+1] += transfer; a[i] -= 2*transfer; } } ll n = a.size(); vector<vector<ll>> dp(n, vector<ll>(4)); dp.back()[0] = 1; dp.back()[1] = 2; dp.back()[2] = 3; dp.back()[3] = 4; for (int i = n-2; i >= 0; i--) { dp[i][0] = dp[i+1][a[i+1]]; dp[i][1] = 2*dp[i+1][a[i+1]]; dp[i][2] = dp[i+1][a[i+1]] + dp[i+1][a[i+1]+1]; dp[i][3] = 2*dp[i+1][a[i+1]+1]; } return dp[0][a[0]]; }

Compilation message (stderr)

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