이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using pLL = array <LL, 2>;
LL count_tastiness(LL x, vector<LL> A) {
A.resize(61);
LL ans = 0;
vector <pLL> dp, ndp, ndp1, ndp2; // {j, dp[i][j]}
dp.push_back({A[0], 1});
for (LL i = 0; i < 60; i++){
if (dp.size() > 200000) break;
for (pLL elm : dp){
LL j = elm[0], val = elm[1];
if (j >= x) ndp1.push_back({A[i + 1] + (j - x) / 2, val});
ndp2.push_back({A[i + 1] + j / 2, val});
}
dp.clear();
merge(ndp1.begin(), ndp1.end(), ndp2.begin(), ndp2.end(), back_inserter(ndp));
for (pLL elm : ndp){
if (dp.empty() || dp.back()[0] != elm[0]) dp.push_back(elm);
else dp.back()[1] += elm[1];
}
ndp.clear();
ndp1.clear();
ndp2.clear();
}
for (pLL elm : dp) ans += elm[1];
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... |