Submission #403425

#TimeUsernameProblemLanguageResultExecution timeMemory
403425AmineTrabelsiPacking Biscuits (IOI20_biscuits)C++14
0 / 100
273 ms332 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
long long count_tastiness(long long x,vector<long long> a) {
    if(x > 100000)return 1;
    vector<long long> powr;
    powr.push_back(1);
    for(int i=1;i<=61;i++){
        powr.push_back(powr.back()*2);
    }
    reverse(a.begin(),a.end());
    int res = 1;
    for(int y=1;y<=100000;y++){
        long long curr = y;
        int pwr = a.size() -1;
        for(auto i:a){
            // if you're going to use this you need x times
            long long cnt = i/x;
            long long p = powr[pwr];
            long long take = min(cnt,curr/p);
            curr -= take*p;
            pwr--;
        }
        if(curr == 0)res++;
    }
	return res;
}

// run biscuits 03.in 03.out
#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...