제출 #411481

#제출 시각아이디문제언어결과실행 시간메모리
411481AKaan37비스킷 담기 (IOI20_biscuits)C++17
9 / 100
1079 ms332 KiB
#include "biscuits.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long lo; 
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define mp make_pair
#define endl "\n"
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo inf = 1000000000000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 500005;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t;
lo cev,cnt[li];
string s;

long long count_tastiness(long long x, std::vector<long long> v) {
	k=(int)v.size();
	cev=0;
	for(int i=0;i<=200000;i++){
		lo tut=i;
		for(int j=k-1;j>=0;j--){
			lo at=tut/(1ll<<j);
			at=min(at,v[j]);
			tut-=at*(1ll<<j);
			cnt[j]=at;
		}
		if(tut)continue;
		tut=0;
		for(int j=k-1;j>=0;j--){
			tut+=cnt[j]*x;
			if(tut>=1000000000)break;
			tut-=v[j];
			tut=max(tut,0ll);
			tut*=2;
		}
		if(tut)continue;
		//~ cout<<i<<endl;
		cev++;
	}
	//~ cout<<endl;
	return cev;
}
#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...