Submission #823900

#TimeUsernameProblemLanguageResultExecution timeMemory
823900drdilyorPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms596 KiB
#include<bits/stdc++.h> #include "biscuits.h" using namespace std; using ll = long long; const int T = 120; long long count_tastiness(long long x, std::vector<long long> a) { assert(x == 1); int k = a.size(); a.resize(T+1); ll cur = 0; for (int i = 0; i <= T; i++) { if (a[i] > 1) { ll d = (a[i] - 1) / 2; a[i] -= d; a[i+1] += d; } } // for (ll i : a) cout << i << ' '; cout << endl; vector<array<ll, 2>> ans(T+2); ans[0] = {1, 0}; for (int i = 0; i <= T; i++) { if (a[i]) { ans[i+1][0] = ans[i][0] + ans[i][1]; ans[i+1][1] = ans[i][0] + ans[i][1]; } else { ans[i+1][0] = ans[i][0] + ans[i][1]; ans[i+1][1] = 0; for (int j = i-1; j >= 0; j--) { if (a[j] == 0) break; if (a[j] == 2) { ans[i+1][1] += ans[j + 1][0]; } } } } // for (ll i : ans) cout << i << ' '; cout << endl; return ans[T+1][0] + ans[T+1][1]; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:9:9: warning: unused variable 'k' [-Wunused-variable]
    9 |     int k = a.size();
      |         ^
biscuits.cpp:11:8: warning: unused variable 'cur' [-Wunused-variable]
   11 |     ll cur = 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...