제출 #392178

#제출 시각아이디문제언어결과실행 시간메모리
392178johutha비스킷 담기 (IOI20_biscuits)C++17
0 / 100
6 ms392 KiB
#include "biscuits.h" #include <iostream> #define int long long using namespace std; int count_tastiness(int x, vector<int> a) { vector<int> pref(63); vector<int> dp(62); a.resize(64); int v = 0; int pw = 1; for (int i = 0; i < 62; i++, pw *= 2) { v += a[i]*pw; int b = v - pw*x; int np = pw / 2; for (int j = i - 1; j >= 0; j--, np /= 2) { if (b >= np*x) { b -= np*x; dp[i] += 1 + pref[j]; } } if (b >= 0) dp[i]++; pref[i + 1] = pref[i] + dp[i]; } return pref.back() + 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...