Submission #305005

# Submission time Handle Problem Language Result Execution time Memory
305005 2020-09-22T11:34:17 Z arnold518 Packing Biscuits (IOI20_biscuits) C++14
9 / 100
1000 ms 1051408 KB
#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();
		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

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 time Memory Grader output
1 Correct 2 ms 1528 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 2 ms 1144 KB Output is correct
5 Correct 1 ms 568 KB Output is correct
6 Correct 4 ms 2196 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 4 ms 2180 KB Output is correct
9 Correct 1 ms 540 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 2 ms 752 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1528 KB Output is correct
2 Execution timed out 1134 ms 1051408 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1140 ms 1051176 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 749 ms 4260 KB Output is correct
2 Execution timed out 1089 ms 5028 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1528 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 2 ms 1144 KB Output is correct
5 Correct 1 ms 568 KB Output is correct
6 Correct 4 ms 2196 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 4 ms 2180 KB Output is correct
9 Correct 1 ms 540 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 2 ms 752 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 1 ms 256 KB Output is correct
15 Correct 2 ms 1528 KB Output is correct
16 Execution timed out 1134 ms 1051408 KB Time limit exceeded
17 Halted 0 ms 0 KB -