Submission #431336

#TimeUsernameProblemLanguageResultExecution timeMemory
431336Andyvanh1Packing Biscuits (IOI20_biscuits)C++14
12 / 100
2 ms332 KiB
#include <bits/stdc++.h> #include "biscuits.h" using namespace std; #define vt vector #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,x) for(int (i) = 0; (i) < (x); (i)++) typedef long long ll; typedef long double ld; typedef vt<int> vi; typedef pair<int,int> pii; vt<ll> A; ll X; int k; bool works(ll cur){ ll now = 0; ll lat = 0; for(int i = 0; i < 60; i++){ if(i<k) now+=A[i]*(1ll<<i); lat+=((1ll<<i)&cur)*X; if(now<lat)return false; } return true; } ll brute_force(ll x, vt<ll> a){ if(x>100000)return 1; X = x; A = a;k =a.size(); ll ans = 0; for(ll i = 100000; i >= 0; i--){ if(works(i))ans++; } return ans; } ll count_tastiness(ll x, vt<ll> a){ k = a.size(); for(int i = 0; i < 65; i++)a.pb(0); k+=65; for(int i = 0; i < k-1; i++){ a[i+1]+=((a[i]-1)/2); a[i]-=((a[i]-1)/2)*2; } ll ans = 1; ll cur = 1; ll curpr = 0; for(int i = 0; i < k; i++){ if(a[i]==0){ ans*=cur; cur = 1; curpr = 0; }else{ cur+= a[i]*(1ll<<curpr); curpr++; } } ans*=cur; 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...