| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1082804 | beaconmc | Packing Biscuits (IOI20_biscuits) | C++14 | 29 ms | 480 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 "biscuits.h"
#include <bits/stdc++.h>
 
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
 
using namespace std;
vector<ll> A(200);
map<vector<ll>, ll> dps;
ll dp(ll pos, ll add){
	if (dps.count({pos, add})) return dps[{pos, add}];
	if (pos>200) return 1;
	ll temp = 0;
	if (add==0){
		FOR(i,0,A[pos]+1){
			temp += dp(pos+1, i/2);
		}
	}else{
		ll idk = (A[pos] + add)/2;
		temp += dp(pos+1, idk);
	}
	dps[{pos, add}] = temp;
	return temp;
}
long long count_tastiness(long long x, std::vector<long long> a) {
	FOR(i,0,200) A[i] = 0;
	dps.clear();
	FOR(i,0,a.size()) A[i] = a[i];
	FOR(i,0,199){
		bool flag = false;
		if (A[i]>=1) A[i]-=1, flag = true;
		A[i+1] += A[i]/2;
		A[i] = A[i]%2;
		if (flag) A[i] += 1;
	}
	// cout << dp(0,0) << endl;
	return dp(0,0);
}
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... | ||||
