Submission #305120

# Submission time Handle Problem Language Result Execution time Memory
305120 2020-09-22T15:37:26 Z Sho10 Packing Biscuits (IOI20_biscuits) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#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 x,ll nr){
if(x==-1){
    return 1;
}
ll &val=dp[x][nr];
if(val!=-1){
    return val;
}
ll b=s[nr]&((1ll<<(x+1))-1);
if(b>s[x]){
    b=s[x];
    nr=x;
}
val=0;
if((1ll<<x)>b){
    val+=solve(x-1,nr);
}else {
val+=solve(x-1,nr-1)+solve(x-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=0;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);
}
return solve(59,59);
}
/*
int32_t main(){
CODE_START;
*/


Compilation message

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:49: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]
   49 | for(ll i=0;i<A.size();i++)
      |            ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -