답안 #304380

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
304380 2020-09-21T08:29:33 Z arnold518 비스킷 담기 (IOI20_biscuits) C++14
0 / 100
2 ms 384 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;

bool solve(ll y)
{
	ll now=0;
	for(int i=59; i>=0; i--)
	{
		if(y&(1ll<<i)) now+=X;
		now=max(0ll, now-A[i]);
		now*=2;
	}
	return now==0;
}

ll count_tastiness(ll _X, vector<ll> _A)
{
	X=_X; P=0;
	memset(A, 0, sizeof(A));
	for(int i=0; i<_A.size(); i++) A[i]=_A[i];

	for(int i=0; i<63; i++) P+=(1ll<<i)*A[i];

	ll now=0, cnt=0, ans=0;
	for(int i=0; i<63; i++)
	{
		now+=A[i];
		if(now==0) cnt++;

		if(P&(1ll<<i)) ans|=(1ll<<(i-cnt));
		now/=2;
	}

	return ans+1;
}

Compilation message

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:27:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for(int i=0; i<_A.size(); i++) A[i]=_A[i];
      |               ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Incorrect 0 ms 256 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -