이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//In the name of God
#include<bits/stdc++.h>
#include "biscuits.h"
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll maxn = 2e5 + 100;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
const ll lg = 130;
#define Mp make_pair
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define Sz(x) ll((x).size())
ll ptr[maxn];
ll dp[lg][maxn];
long long count_tastiness(long long x, vector<long long> a){
a.resize(lg, 0);
for(ll i = 0; i + 1 < lg; i++){
ll y = max(0ll, (a[i] - x) / 2);
a[i] -= y * 2;
a[i + 1] += y;
}
ll ls = 0;
for(ll i = 0; i < lg; i++){
if(a[i]) ls = i;
}
dp[0][0] = 1;
for(ll i = 0; i < ls + 2; i++){
for(ll j = 0; j <= x; j++){
dp[i + 1][j] = 0;
}
for(ll j = 0; j <= x; j++){
dp[i + 1][((j + a[i]) >> 1)] += dp[i][j];
if(j + a[i] >= x) dp[i + 1][((j + a[i] - x) >> 1)] += dp[i][j];
}
}
ll ans = 0;
for(ll i = 0; i <= x; i++){
ans += dp[ls + 1][i];
}
return ans;
}
# | 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... |