Submission #420296

#TimeUsernameProblemLanguageResultExecution timeMemory
420296vkgainzPacking Biscuits (IOI20_biscuits)C++17
12 / 100
12 ms1132 KiB
#include <bits/stdc++.h> using namespace std; bool can_make(vector<long long> nums, long long x) { for(int i = 0; i < (int) nums.size(); i++) { if(nums[i] < x) return false; nums[i] -= x; if(i < (int) nums.size() - 1) nums[i + 1] += nums[i] / 2; } return true; } long long count_tastiness(long long x, vector<long long> a) { long long ans = 1; long long curr = a[0], lst = 0; for(int i = 1; i < (int) a.size(); i++) { vector<long long> temp; for(int x = lst; x < i; x++) { temp.push_back(a[x]); } if(!can_make(temp, x)) ans *= (curr + x) / x, curr = 0, lst = i; curr += (1LL << (i - lst)) * a[i]; } ans *= ((curr + x) / x); 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...