Submission #303866

#TimeUsernameProblemLanguageResultExecution timeMemory
303866tutis비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1086 ms384 KiB
#include "biscuits.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; typedef long long ll; using namespace __gnu_pbds; ll count_tastiness(ll x, vector<ll> a) { while (a.size() <= 60) a.push_back(0); ll s[61]; s[60] = 0; for (int i = 59; i >= 0; i--) { s[i] = a[i] + s[i + 1] * 2; if (s[i] >= 3 * x) s[i] = 3 * x; } cc_hash_table<ll, ll>M[61]; function<ll(ll, int)>get = [&](ll d, int i)->ll { if (i == 60) return d / x + 1; bool ok = false; ll sum = d * 2; for (int j = i; j < 60; j++) { sum /= 2; sum += a[j]; if (sum >= x) { ok = true; break; } } if (!ok) return 1; if (a[i] + d < x) { return get((d + a[i]) / 2, i + 1); } else { return get((d + a[i]) / 2, i + 1) + get((d + a[i] - x) / 2, i + 1); } }; return get(0, 0); }
#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...