Submission #601038

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6010382022-07-21 10:23:58pakhomoveeStove (JOI18_stove)C++17
100 / 100
795 ms8948 KiB
#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() {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...