Submission #1069467

#TimeUsernameProblemLanguageResultExecution timeMemory
1069467HD1Packing Biscuits (IOI20_biscuits)C++14
9 / 100
1100 ms348 KiB
#include "biscuits.h" #include <iostream> using namespace std; long long count_tastiness(long long x, std::vector<long long> a) { int s = 0,k = a.size(); for(int i = 0; i < k; i++) s += a[i] * (1<<i); int ans = 1; for(int i = 1; i <= s/x; i++){ vector<long long> b = a; bool go = true; for(int j = 0; j < 20; j++){ if(i&(1<<j)){ for(int _ = 0; _ < x; _++){ int c = j, cant = 1; while(c >= k){ c--; cant *= 2; } while(c >= 0 && b[c] < cant){ cant -= b[c]; cant *= 2; b[c] = 0; c--; } if(c==-1) { go = false; break; } b[c] -= cant; } } } if(go) { ans++; } } return ans; }
#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...