Submission #1062079

#TimeUsernameProblemLanguageResultExecution timeMemory
1062079YassirSalamaPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms604 KiB
#include "biscuits.h" #include<bits/stdc++.h> using namespace std; #define int long long #define all(v) v.begin(),v.end() template<typename T> void dbg(const T& t){ cout<<t<<endl; } template<typename T,typename... Args> void dbg(const T& t,const Args&... args){ cout<<t<<" , "; dbg(args...); } #define dbg(...) cout<<"("<<#__VA_ARGS__<<") : ";dbg(__VA_ARGS__); int count_tastiness(int x, vector<int> a) { int n=a.size(); int s=0; for(int i=0;i<n;i++){ s+=a[i]*(1LL<<i); } return s+1; } int cnt(int x, vector<int> a) { int n=a.size(); int ans = 0; int s=0; for(int i=0;i<n;i++){ s+=a[i]*(1LL<<i); } auto check = [&](int mid,int y){ vector<int> b(61); int m=61; for(int i=0;i<n;i++) b[i]=a[i]; for(int j=0;j<m;j++){ if((1LL<<j)&y){ if(b[j]<mid) return false; b[j]-=mid; } if(j+1<m) b[j+1]+=(b[j]>>1); } return true; }; for(int y=0;y<=s;y++){ if(check(x,y)){ 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...