제출 #1031308

#제출 시각아이디문제언어결과실행 시간메모리
1031308happy_node비스킷 담기 (IOI20_biscuits)C++17
56 / 100
20 ms1312 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; map<ll, ll> dp; vector<ll> s; ll x; ll g(ll n) { if(n<=0) return 0; if(n==1) return 1; if(dp.count(n)) return dp[n]; ll b=0, p=1; while(p<n) b++,p*=2; p/=2; b--; return dp[n]=g(p)+g(min(n,1+s[b]/x)-p); } long long count_tastiness(long long X, std::vector<long long> a) { x=X; while(a.size()<60) a.push_back(0); s.clear(); dp.clear(); ll sum=0; for(int i=0;i<60;i++) { sum+=(1LL<<i)*a[i]; s.push_back(sum); } return g((ll)1e18); }
#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...