제출 #313816

#제출 시각아이디문제언어결과실행 시간메모리
313816srvlt비스킷 담기 (IOI20_biscuits)C++14
9 / 100
111 ms384 KiB
#include "biscuits.h" #include <bits/stdc++.h> #define ll long long #define pb push_back #define SZ(x) (int)(x).size() #define all(x) begin(x), end(x) using namespace std; const int n0 = 1e5; ll count_tastiness(ll x, vector<ll> a) { ll s = 0; for (ll i = 0; i < SZ(a); i++) s += (1ll << i) * a[i]; if (x > s) return 1; ll res = 0; if (s <= n0) { for (ll i = 0; i <= s; i++) { ll cur = 0; for (ll j = 59; j >= 0; j--) { if (i >> j & 1) cur += x; if (j < SZ(a)) cur -= min(cur, a[j]); cur *= 2; } res += (cur == 0); } } else if (x == 1) { ll r = 0, res = 1, cur = 1; for (ll j = 0; j < 60; j++) { if (!a[j]) continue; ll t = (1ll << j) / cur; if (t > r + 1) { res *= (r + 1); cur = (1ll << j); r = 0; } t = (1ll << j) / cur; if (t <= r + 1) r += a[j] * t; } res *= (r + 1); } return res; }
#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...