제출 #315664

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3156642020-10-23 15:25:11Sorting비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1 ms384 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x, k;
vector<ll> a;
map<pair<int, ll>, ll> dp;
ll solve(int idx, ll add){
//cout << "solve " << idx << " " << add << endl;
if(idx == k) return add + 1;
if(dp.count({idx, add})) return dp[{idx, add}];
ll &ans = dp[{idx, add}];
ll sum = a[idx] + add;
if(!sum) ans = solve(idx + 1, 0);
else if(sum & 1) ans = solve(idx + 1, sum >> 1) * 2;
else ans = solve(idx + 1, sum >> 1) + solve(idx + 1, (sum - 1) >> 1);
return ans;
}
ll count_tastiness(ll _x, vector<ll> _a){
x = _x, a = _a;
k = a.size();
return solve(0, 0);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...