제출 #834661

#제출 시각아이디문제언어결과실행 시간메모리
834661Johann비스킷 담기 (IOI20_biscuits)C++14
9 / 100
1096 ms1517024 KiB
#include "biscuits.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() ll X; long long count_tastiness(long long _X, std::vector<long long> a) { X = _X; vector<ll> S(sz(a) + 1, 0); ll base = 1; for (int i = 0; i < sz(a); ++i) { S[i] += a[i] * base; S[i + 1] += S[i]; base *= 2; } ll ans = 1; vector<ll> A(1, 0); base = 1; for (int i = 0; base * X <= S.back(); ++i) { ll size = sz(A); ll bound = (i < sz(S)) ? S[i] : S.back(); for (int j = 0; j < size; ++j) { ll y = A[j]; if ((y + base) * X <= bound) A.push_back(y + base), ++ans; } base *= 2; } return ans; }
#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...