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

#TimeUsernameProblemLanguageResultExecution timeMemory
303427qiangbaoPacking Biscuits (IOI20_biscuits)C++14
100 / 100
17 ms896 KiB
#include <iostream> #include <vector> #include "biscuits.h" using namespace std; typedef long long ll; ll ways[63]; ll ct[63]; ll pow2[63]; void ini() { ll i; pow2[0]=1; for(i=1;i<=62;i++) pow2[i]=pow2[i-1]*2; for(i=0;i<=62;i++) ways[i]=0; ways[0]=1; } ll count_tastiness(ll x, vector<ll> a) { ll tot=0; ll i, j; a.resize(64); ini(); for(i=0;i<62;i++){ ll way=0; tot+=a[i]*pow2[i], ct[i]=tot; ll tot2=tot; for(j=i;j>=0;j--){ tot2=min(tot2, ct[j]); if(pow2[62]/x>=pow2[j] && tot2>=x*pow2[j]) tot2-=x*pow2[j], way+=ways[j]; } ways[i+1]=way+1; } return ways[62]; } //int main() //{ // cout << count_tastiness(2, {1, 1}) << endl; // cout << count_tastiness(3, {2, 3}) << endl; //}
#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...