제출 #412388

#제출 시각아이디문제언어결과실행 시간메모리
412388achibasadzishviliPacking Biscuits (IOI20_biscuits)C++17
0 / 100
9 ms304 KiB
#include "biscuits.h"
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
ll pre[505],n;
map<ll,pair<ll,ll> >got;
ll solve(ll k){
	if(k <= 0)return 0;
	if(got[k].f)return got[k].s;
	ll ret = 0;
	ll pw = 1,t = 0;
	while(2 * pw < k){
		t++;
		pw *= 2;
	}
	ret = solve(pw) + solve(min(k ,1 + pre[t] / n) - pw);
	got[k] = {1 , ret};
	//cout << k << " " << ret << '\n';
	return ret;
}
ll count_tastiness(ll x, vector<ll> a){
	got.clear();
	for(int i=0; i<a.size(); i++){
		if(!i)pre[i] = a[i] * (1LL << i);
		else pre[i] = pre[i - 1] + a[i] * (1LL << i);
	}
	n = x;
	got[1] = {1 , 1};
	return solve(1e18);
}

컴파일 시 표준 에러 (stderr) 메시지

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