제출 #666943

#제출 시각아이디문제언어결과실행 시간메모리
666943djs100201비스킷 담기 (IOI20_biscuits)C++17
0 / 100
2 ms1016 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; using ll = long long; map<pair<ll, ll>, ll>mp; vector<ll>pre; ll f(ll x, ll y) { if (y < 0)return 0; if (x == -1)return y + 1; if (mp.find({ x,y }) != mp.end())return mp[{x, y}]; ll ret = f(x - 1, min({ pre[x],(1ll << x) - 1,y })); ret += f(x - 1, min({ pre[x] - (1ll << x),(1ll << x) - 1,y - (1ll << x) })); return mp[{x, y}] = ret; } long long count_tastiness(long long x, vector<long long> A) { ll k = A.size(), sum = 0; for (ll i = 0; i < k; i++) { sum += (A[i] << i); pre.push_back(sum / x); } for (int i = k; i <= 59; i++)pre.push_back(sum/x); return f(59, (1ll << 60) - 1); }
#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...