Submission #374767

#TimeUsernameProblemLanguageResultExecution timeMemory
374767Jarif_RahmanPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms492 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; ll count_tastiness(ll x, vector<ll> a){ int k = a.size(); a.resize(3*k, 0); ll ans = 0, cnt1 = 0, cnt2 = 0, ls = 1, cur = 1; for(int i = 0; i < 3*k; i++){ if(a[i] == 0){ ls*=cur; cur = 1; cnt1 = 0; cnt2 = 0; continue; } cur = cnt1; if(a[i] > 1) cur+=cnt2; cur = 1LL<<cur; ans+=cur*ls; if(a[i]%2 == 0) cnt2++; else cnt1++; if(i != 3*k-1) a[i+1]+=a[i]/2; } return ans; }
#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...