Submission #374783

#TimeUsernameProblemLanguageResultExecution timeMemory
374783Jarif_RahmanPacking Biscuits (IOI20_biscuits)C++17
0 / 100
3 ms444 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; const int kk = 200; ll count_tastiness(ll x, vector<ll> a){ int k = a.size(); a.resize(kk, 0); ll ans = 0, ls = 1, cur = 1; vector<ll> cnt1(kk, 0), cnt2(kk, 0); for(int i = 0; i < kk; i++){ if(i != 0){ cnt1[i] = cnt1[i-1]; cnt2[i] = cnt2[i-1]; } if(a[i] == 0){ ls*=cur; cur = 1; cnt1[i] = 0; cnt2[i] = 0; continue; } cur = cnt1[i]; if(a[i] > 1) cur+=cnt2[i]; cur = 1LL<<cur; ans+=cur*ls; if(a[i]%2 == 0) cnt2[i]++; else cnt1[i]++; if(i != kk-1) a[i+1]+=a[i]/2; a[i]%=2; if(a[i+1] == 1) ls*=cur; } ans++; return ans; }

Compilation message (stderr)

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