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

#TimeUsernameProblemLanguageResultExecution timeMemory
1090708onlk97Packing Biscuits (IOI20_biscuits)C++14
21 / 100
126 ms436 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 (long long i=0; i<a.size(); i++){ sum+=1LL*a[i]*(1ll<<i); if (sum<(1ll<<(i+1))){ ans*=(sum/(1ll<<st)+1); sum=0; st=i+1; } } ans*=(sum/(1ll<<st)+1); return ans; } }

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:30: 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]
   29 |         for (long long i=0; i<a.size(); i++){
      |                             ~^~~~~~~~~
biscuits.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
#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...