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

#TimeUsernameProblemLanguageResultExecution timeMemory
622922JeanBombeurPacking Biscuits (IOI20_biscuits)C++17
100 / 100
14 ms1308 KiB
#include "biscuits.h" #include <iostream> #include <cstdio> using namespace std; // <|°_°|> // M. Broccoli const int NB_BITS = 60; long long DP[NB_BITS + 1]; long long count_tastiness(long long nbPacks, vector <long long> Biscuits) { Biscuits.resize(NB_BITS); DP[0] = 1; for (int i = 1; i < NB_BITS; i ++) { Biscuits[i] = (Biscuits[i] << i) + Biscuits[i - 1]; } for (int i = 0; i < NB_BITS; i ++) { DP[i + 1] = 1; long long sum = Biscuits[i]; for (int j = i; j >= 0; j --) { sum = min(sum, Biscuits[j]); if (nbPacks <= (sum >> j)) DP[i + 1] += DP[j], sum -= (nbPacks << j); } } return DP[NB_BITS]; }
#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...