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

#TimeUsernameProblemLanguageResultExecution timeMemory
1090694onlk97Packing Biscuits (IOI20_biscuits)C++14
9 / 100
126 ms600 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; long long count_tastiness(long long x,vector <long long> a){ long long sum=0; for (long long i=0; i<a.size(); i++) sum+=a[i]*(1LL<<i); if (sum<=100000){ int ans=1; for (int tar=1; tar<=sum/x; tar++){ vector <long long> v=a; bool ok=1; for (int i=1; i<=x; i++){ long long rem=tar; for (int j=a.size()-1; j>=0; j--){ long long g=min(rem/(1ll<<j),v[j]); rem-=g*(1ll<<j); v[j]-=g; } if (rem){ ok=0; break; } } if (ok) ans++; } return ans; } else if (x==1){ long long ans=1,sum=0,st=0; for (int i=0; i<a.size(); i++){ sum+=a[i]*(1ll<<i); if (sum<(1ll<<(i+1))){ ans*=(sum/(1ll<<st)+1); sum=0; st=i+1; } } ans*=(sum/(1<<st)+1); return ans; } return sum+1; }

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:6:26: 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]
    6 |     for (long long i=0; i<a.size(); i++) sum+=a[i]*(1LL<<i);
      |                         ~^~~~~~~~~
biscuits.cpp:29:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for (int 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...