# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
964277 | rolandpetrean | Constellation 3 (JOI20_constellation3) | C++17 | 545 ms | 103500 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 <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll // srry
#define endl '\n'
#define pb push_back
using pi = array<int, 2>;
// i want to maximize costs of full set, remove from total
// max(a[i..j]) < min(s[i].y, s[j].y)
/*
cartesian tree on maximums of a
consider i
dp[i] = dp[parent]
consider some star with x = i
if i pick this star, then i can't pick any star in my subtree with y > a[i]
maximums of ancestors are increasing
~~let p be the first ancestor with a[p] >= y~~
~~dp[i] = max(dp[i], max_to_root[p] + s.cost)~~
let p be the last ancestor with a[p] < y
i have like chains from x to p, each has a cost
i need to pick disjoint set of chains with max cost
each node of the tree has <=2 children
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |