제출 #1051719

#제출 시각아이디문제언어결과실행 시간메모리
1051719fuad27비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1 ms348 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; map<pair<int, long long>, long long> mp; long long X; vector<long long> A; int k; long long dp[61][10020]; long long solve(int i, long long add) { if(i == k)return 1; if(dp[i][add] != -1)return mp[{i, add}]; if(add+A[i] >= X) { dp[i][add] += solve(i+1, (add+A[i]-X)/2); } dp[i][add] += solve(i+1, (add+A[i])/2); return dp[i][add]; } long long count_tastiness(long long x, std::vector<long long> a) { mp.clear(); X=x; A=a; k = 60; A.resize(61); for(int i = 0;i<k;i++) { if(A[i] > x) { long long c = A[i]-x; A[i+1] += c/2; c/=2; c*=2; A[i] -= c; } } return solve(0, 0); }
#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...