제출 #1062088

#제출 시각아이디문제언어결과실행 시간메모리
1062088YassirSalama비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1 ms348 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); } int ans=s+1; vector<int> b(61); for(int i=0;i<n;i++) b[i]=a[i]; for(int i=0;i<61;i++){ if(b[i]==0){ ans-=s/(1LL<<i); } } return ans; } 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++; dbg(y) } } 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...