# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601038 | pakhomovee | Stove (JOI18_stove) | C++17 | 795 ms | 8948 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
#define int long long
const int maxn = 100'001;
const int inf = 1e18;
int dp[maxn];
int dp1[maxn];
pair<int, int> eval(int lambda, vector<int> &t) {
const int n = t.size();
fill(dp, dp + maxn, inf);
fill(dp1, dp1 + maxn, inf);
dp[0] = 0;
dp1[0] = 0;
set<pair<int, int>> s;
for (int i = 1; i <= n; ++i) {
s.insert({ dp[i - 1] - t[i - 1] + 1 + lambda, dp1[i - 1] });
auto [val, cnt] = *s.begin();
dp[i] = val + t[i - 1];
dp1[i] = cnt + 1;
}
return { dp[n], dp1[n] };
}
int32_t main() {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |