# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
400356 | REALITYNB | Packing Biscuits (IOI20_biscuits) | C++14 | 2 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "biscuits.h"
#define int long long
using namespace std;
int count_tastiness(int x ,vector<int> a){
int n =a.size()*2;
while(a.size()!=n) a.push_back(0) ;
vector<int> dp(n+1) ;
dp[n]=1;
for(int i=n-1;i>-1;i--){
vector<int> b = a ;
int stop=i+1;
for(int j=i;j<n;j++){
if(b[j]>1){
b[j+1]+=b[j]/2 ;
if(b[j]&1) b[j]=1;
else b[j]=0;
stop=j+2;
}
else break ;
}
for(int j=i;j<stop;j++){
if(b[j]==1){
dp[i]+=dp[stop]*(1<<(j-i)) ;
}
}
dp[i]+=dp[i+1];
}
return dp[0]-1 ;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |