Submission #303608

# Submission time Handle Problem Language Result Execution time Memory
303608 2020-09-20T13:18:08 Z cgiosy Packing Biscuits (IOI20_biscuits) C++17
0 / 100
1000 ms 384 KB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

ll count_tastiness(ll x, vector<ll> A) {
	const int N=A.size();
	vector<ll> D(N);
	for(int i=1; i<N; i++) A[i]=A[i-1]+(A[i]<<i);
	D[0]=(A[0]>=x)+1;
	for(int i=1; i<N; i++) {
		D[i]=D[i-1];
		ll v=min(A[i]/x, (ll(1)<<i+1)-1);
		if(!(v&1<<i)) continue;
		D[i]++;
		v^=1<<i;
		while(v) {
			int j=63-__builtin_clzll(v);
			v^=1<<j;
			D[i]+=j ? D[j-1] : 1;
		}
	}
	return D[N-1];
}

Compilation message

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:13:29: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   13 |   ll v=min(A[i]/x, (ll(1)<<i+1)-1);
      |                            ~^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -