(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 #574050

#TimeUsernameProblemLanguageResultExecution timeMemory
574050keta_tsimakuridzePacking Biscuits (IOI20_biscuits)C++14
100 / 100
43 ms1328 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; #define int long long int cn[65], sum[65], x; int solve(int R, int Bit) { R = min(R, min((1ll << (Bit + 1)) - 1, sum[Bit] / x)); if(R < (1ll << Bit)) return 0; if(R == (1ll << Bit)) return 1; int B = __lg(R - (1ll << Bit)); return solve(R - (1ll << Bit), B) + (B == 0 ? 1ll : cn[B - 1]); } long long count_tastiness(long long X, std::vector<long long> a) { x = X; while(a.size() < 60) a.push_back(0); for(int i = 0; i <= 59; i++) { sum[i] = (1ll << i) * a[i]; if(i) sum[i] += sum[i - 1]; if(i) cn[i] = cn[i - 1]; else cn[i] = 1; cn[i] += solve((1ll << (i + 1)) - 1, i); } return cn[59]; }
#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...