Submission #590190

# Submission time Handle Problem Language Result Execution time Memory
590190 2022-07-05T16:12:01 Z Lucpp Packing Biscuits (IOI20_biscuits) C++17
42 / 100
1000 ms 43420 KB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
const int k = 60;
ll x;
vector<ll> a;
 
vector<unordered_map<ll, ll>> dp;
 
ll calc(int i, ll cnt){
	if(i == k) return 1;
	if(dp[i].count(cnt)) return dp[i][cnt];
	ll ans = 0;
	if(cnt+a[i] >= x){
		ans += calc(i+1, (cnt+a[i]-x)/2);
	}
	ans += calc(i+1, (cnt+a[i])/2);
	return dp[i][cnt] = ans;
}
 
ll count_tastiness(ll x_, vector<ll> a_) {
	x = x_; a = a_;
	a.resize(k);
	for(int i = 0; i < k; i++){
		if(a[i] <= x+1) continue;
		ll cnt = (a[i]-x)/2;
		a[i] -= 2*cnt;
		a[i+1] += cnt;
	}
	dp.clear();
	dp.resize(k);
	return calc(0, 0);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 300 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 13888 KB Output is correct
2 Correct 104 ms 7596 KB Output is correct
3 Correct 175 ms 12056 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 439 ms 14316 KB Output is correct
9 Correct 286 ms 10364 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 7 ms 596 KB Output is correct
12 Correct 81 ms 2772 KB Output is correct
13 Correct 462 ms 14448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 43420 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 300 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 64 ms 13888 KB Output is correct
25 Correct 104 ms 7596 KB Output is correct
26 Correct 175 ms 12056 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 300 KB Output is correct
31 Correct 439 ms 14316 KB Output is correct
32 Correct 286 ms 10364 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 7 ms 596 KB Output is correct
35 Correct 81 ms 2772 KB Output is correct
36 Correct 462 ms 14448 KB Output is correct
37 Execution timed out 1061 ms 43420 KB Time limit exceeded
38 Halted 0 ms 0 KB -