(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 #1064688

#TimeUsernameProblemLanguageResultExecution timeMemory
1064688thatsgonzalezPacking Biscuits (IOI20_biscuits)C++14
0 / 100
1079 ms416 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; #define s second #define f first long long count_tastiness(long long x, std::vector<long long> a) { int k = a.size(); map<long long, long long> mp; //for(auto &x: p) cout<<x<<" "; cout<<endl; long long s = 0; for(int i = 0; i<k; i++){ mp[(1<<i)]+=a[i]; s+=a[i]*(1<<i); } //cout<<s<<endl; int ans = 0; int log = 0; while((1<<log)<=s) log++; for(int i = s; i>=0; i--){ map<long long,long long> used; bool band = true; for(long long j = (1<<log); j>0; j/=2){ if((i&j)){ long long need = 0; for(int c = j, h = 0; c>0; c/=2, h++){ if(!mp[c]) continue; long long pivot = (1<<h); if((mp[c]-used[c])/pivot>=(x-need)){ used[c] += (x-need)*pivot; need = x; } else{ need += (mp[c]-used[c])/pivot; used[c] += (mp[c]-used[c])/pivot*pivot; } if(used[c]>mp[c]){ band = false; break; } } if(need != x) band = false; } } if(band) { //cout<<i<<endl; //for(auto &item: used) cout<<item.f<<" "<<item.s<<endl; ans++; } } 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...