제출 #321522

#제출 시각아이디문제언어결과실행 시간메모리
321522grt비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1095 ms492 KiB
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using ll = long long; using pi = pair<int,int>; #define ST first #define ND second #define PB push_back map<pair<int, ll>, ll>dp; vector<ll>A; ll X; ll rec(int a, ll add) { if(dp.find({a,add}) != dp.end()) return dp[{a,add}]; ll cur = A[a] + add; if(a >= 63) return 1; ll ans = 0; if(cur >= X) { cur -= X; if(dp.find({a + 1, cur/2}) != dp.end()) ans+=dp[{a+1,cur/2}]; else ans += rec(a + 1, cur / 2); cur += X; } if(dp.find({a+1,cur/2}) != dp.end()) ans += dp[{a+1, cur/2}]; else ans += rec(a + 1, cur/2); return ans; } ll count_tastiness(ll x, vector<ll>a) { A.resize(64); for(int i = 0; i < (int)a.size(); ++i) A[i] = a[i]; X = x; dp.clear(); return rec(0, 0); } //int main() { // cout << count_tastiness(2,{2,1,2}); //}
#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...