(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #411014

#TimeUsernameProblemLanguageResultExecution timeMemory
411014SeDunionPacking Biscuits (IOI20_biscuits)C++17
100 / 100
98 ms844 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; using ll = long long; map<ll,ll>mp; ll S[66]; int K; ll x; ll g(ll n) { if (n <= 1) return n == 1 ? 1 : 0; if (mp.count(n)) return mp[n]; int i = 60; while ((1ll << i) >= n) --i; mp[n] = g(1ll << i) + g(min(n, 1 + S[i] / x) - (1ll << i)); return mp[n]; } ll count_tastiness(ll x_, vector<ll> a) { mp.clear(); K = 62; while ((int)a.size() < K) a.push_back(0); x = x_; for (int i = 0 ; i < K ; ++ i) S[i] = 0; for (int i = 0 ; i < K ; ++ i) { for (int j = 0 ; j <= i ; ++ j) { S[i] += (1ll << j) * a[j]; } } return g(S[K-1]+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...