제출 #772420

#제출 시각아이디문제언어결과실행 시간메모리
772420ono_de206비스킷 담기 (IOI20_biscuits)C++14
42 / 100
1076 ms73736 KiB
#include "biscuits.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// #define int long long
 
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

long long count_tastiness(long long x, vector<long long> a) {
	while(a.size() < 80) a.pb(0);
	vector<unordered_map<long long, long long>> dp0(80), dp1(80);
	dp0[0][a[0]] = 1;
	if(a[0] >= x) dp1[0][a[0] - x] = 1;
	for(int i = 1; i < 80; i++) {
		for(auto it : dp0[i - 1]) {
			long long tot = it.ff / 2;
			long long val = it.ss;
			dp0[i][a[i] + tot] += val;
			if(a[i] + tot >= x) dp1[i][a[i] + tot - x] += val;
		}
		for(auto it : dp1[i - 1]) {
			long long tot = it.ff / 2;
			long long val = it.ss;
			dp0[i][a[i] + tot] += val;
			if(a[i] + tot >= x) dp1[i][a[i] + tot - x] += val;
		}
	}
	long long ret = 0;
	for(auto it : dp0.back()) {
		ret += it.ss;
	}
	for(auto it : dp1.back()) {
		ret += it.ss;
	}
	return ret;
}

#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...