Submission #600922

#TimeUsernameProblemLanguageResultExecution timeMemory
600922PiejanVDCPacking Biscuits (IOI20_biscuits)C++17
9 / 100
173 ms340 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;

long long count_tastiness(long long x, vector<long long>a) {
    int k = a.size();
    long long ans = 0;
    for(int i = 1 ; i <= 100000 ; i++) {
        int cnt = x;
        if(100000 / i < x)
            break;
        vector<long long>b = a;
        int got = 0;
        while(cnt--) {
            long long need = i;
            for(int j = k-1 ; j >= 0 ; j--) {
                if((1 << j) <= need) {
                    int c = min(b[j], need / (1 << j));
                    need -= c * (1 << j);
                    b[j] -= c;
                }
            }
            if(!need)
                got++;
            else
                break;
        }
        if(got == x)
            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...