# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065760 | n1k | 비스킷 담기 (IOI20_biscuits) | C++17 | 1038 ms | 91472 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>
using namespace std;
using ll = long long;
const int K = 61;
long long count_tastiness(long long x, std::vector<long long> a) {
vector<ll> cnt(K+5);
for(int i=0; i<a.size(); i++) cnt[i] = a[i];
ll ans = 0;
cerr<<x<<endl;
for(int i=0; i<K; i++){
ll take = max(0ll, (cnt[i]-x)/2);
cnt[i+1] += take;
cnt[i] -= 2*take;
}
for(auto e:cnt) cerr<<e<<" "; cerr<<endl;
vector<map<ll, ll>> dp(K+5);
dp[0][0] = 1;
for(int i=0; i<K; i++){
for(auto [add, val]:dp[i]){
ll have = cnt[i] + add;
// take
if(have >= x){
dp[i+1][(have - x) / 2] += val;
}
dp[i+1][have/2] += val;
}
}
for(auto [k, v]:dp[K]) {
//cerr<<k<<" "<<v<<endl;
ans+=v;
}
return ans;
}
/*
1
4 1
0 0 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... |