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

#TimeUsernameProblemLanguageResultExecution timeMemory
305139Sho10Packing Biscuits (IOI20_biscuits)C++14
100 / 100
29 ms924 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 //#include "biscuits.h" #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define sz size #define f first #define s second #define pb push_back #define er erase #define in insert #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll s[65],dp[65][65],x,a[105]; ll solve(ll bit,ll nr){ if(bit==-1)return 1; ll &val=dp[bit][nr]; if(val!=-1) { return val; } ll b=s[nr]&((1ll<<(bit+1))-1); if(b>s[bit]){ b=s[bit]; nr=bit; } val=0; if((1ll<<bit)>b){ val+=solve(bit-1,nr); }else { val+=solve(bit-1,bit-1)+solve(bit-1,nr); } return val; } ll count_tastiness(ll X,vector<ll>A){ x=X; memset(a,0,sizeof(a)); for(ll i=0;i<A.size();i++) a[i]=A[i]; for(ll i=0;i<60;i++) s[i]=(1ll<<i)*a[i]; for(ll i=1;i<60;i++) s[i]+=s[i-1]; for(ll i=0;i<60;i++) s[i]/=x; for(ll i=0;i<60;i++) s[i]=min(s[i],(1ll<<(i+1))-1); memset(dp,-1,sizeof(dp)); return solve(59,59); } /* int32_t main(){ CODE_START; */

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:48:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 | for(ll i=0;i<A.size();i++)
      |            ~^~~~~~~~~
#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...