Submission #400013

#TimeUsernameProblemLanguageResultExecution timeMemory
400013faresbasbsPacking Biscuits (IOI20_biscuits)C++14
44 / 100
164 ms3580 KiB
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
long long all[200001];

long long count_tastiness(long long x , vector<long long> a){
	while(a.size() < 60){
		a.push_back(0ll);
	}
	long long sum = 0 , cnt = 1 , val = 1;
	for(int i = 0 ; i < (int)a.size() ; i += 1){
		sum += val*a[i];
		long long y = min(sum/x,2*val-1);
		if(y >= val){
			int f = cnt;
			for(int j = 0 ; j < f ; j += 1){
				if(all[j]+val > y){
					break;
				}
				all[cnt++] = all[j]+val;
			}
		}
		val *= 2;
	}
	return cnt;
}
#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...