이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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<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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |