# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
829152 | 2023-08-18T05:33:44 Z | definitelynotmee | 비스킷 담기 (IOI20_biscuits) | C++17 | 0 ms | 0 KB |
#include "biscuits.h" #include"grader.cpp" #include<bits/stdc++.h> #define ff first #define ss second #define all(x) x.begin(), x.end() using namespace std; using ll = long long; using pii = pair<int,int>; const ll INFL = 2e18; using pll = pair<ll,ll>; long long count_tastiness(long long x, std::vector<long long> a) { a.resize(60,0); int k = a.size(); vector<ll> ct(k); ct[0] = a[0]; for(int i = 1; i < k; i++){ ct[i] = a[i]*(1ll<<i)+ct[i-1]; } vector<ll> poss = {0}; poss.reserve(2e5); for(int i = 0; i < k; i++){ if((1ll<<i)*x >= INFL) break; int n = poss.size(); for(int j = 0; j < n; j++){ if(ct[i]-poss[j]*x >= (1ll<<i)*x) poss.push_back((1ll<<i)+poss[j]); } } return poss.size(); }