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

#TimeUsernameProblemLanguageResultExecution timeMemory
306482peti1234Packing Biscuits (IOI20_biscuits)C++17
100 / 100
17 ms896 KiB
#include<bits/stdc++.h> using namespace std; const int c=60; long long dp[c+1], b[c+1], h, o=0, sum; long long count_tastiness(long long x, vector<long long> a) { while(a.size()<c) a.push_back(0); b[0]=a[0], dp[0]=1; for (int i=1; i<c; i++) b[i]=b[i-1]/2+a[i]; for (int i=1; i<=c; i++) { dp[i]=dp[i-1]; if (b[i-1]>=x) { h=max(o, x-a[i-1])*2, sum=0; for (int j=i-2; j>=0; j--) { if (b[j]>=x+h) sum+=dp[j], h=max(o, h+x-a[j])*2; else h=max(o, h-a[j])*2; } if (!h) sum++; dp[i]+=sum; } } return dp[c]; }
#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...