Submission #305003

#TimeUsernameProblemLanguageResultExecution timeMemory
305003arnold518Packing Biscuits (IOI20_biscuits)C++14
9 / 100
1144 ms1051156 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
ll X, A[100], P[100];

ll count_tastiness(ll _X, vector<ll> _A)
{
	X=_X;
	memset(A, 0, sizeof(A));
	for(int i=0; i<_A.size(); i++) A[i]=_A[i];
 
	for(int i=0; i<60; i++) P[i]=(1ll<<i)*A[i];
	for(int i=1; i<60; i++) P[i]+=P[i-1];
	for(int i=0; i<60; i++) P[i]/=X;
 
	vector<ll> V;
	V.push_back(0);
	for(int i=0; i<60; i++)
	{
		int t=V.size();
		while(!V.empty() && V.back()>P[i]) V.pop_back();
		for(int j=0; j<t && V[j]+(1ll<<i)<=P[i]; j++) V.push_back(V[j]+(1ll<<i));
	}
	return V.size();
}

Compilation message (stderr)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(int i=0; i<_A.size(); i++) A[i]=_A[i];
      |               ~^~~~~~~~~~
#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...