(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #309723

#TimeUsernameProblemLanguageResultExecution timeMemory
309723georgerapeanuPacking Biscuits (IOI20_biscuits)C++17
100 / 100
52 ms896 KiB
#include "biscuits.h" #include <vector> #include <algorithm> #include <unordered_map> using namespace std; const int maxK = 128; long long s[64]; long long X; unordered_map<long long,long long> ans; long long solve(long long n){ if(n <= 0){ return 0; } if(n == 1){ return 1; } if(ans.count(n) == 0){ int bit = 62; while(((n - 1) >> bit) == 0){ bit--; } ans[n] = solve(1LL << bit) + solve(min(n,1 + s[bit] / X) - (1LL << bit)); } return ans[n]; } long long count_tastiness(long long x, vector<long long> a) { ans.clear(); X = x; for(int i = 0;i < 61;i++){ s[i] = ((i < (int)a.size() ? a[i]:0) << i) + (i > 0 ? s[i - 1]:0); } return solve(1LL << 61); }
#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...