제출 #1052448

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