제출 #964277

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9642772024-04-16 14:23:00rolandpetrean별자리 3 (JOI20_constellation3)C++17
100 / 100
545 ms103500 KiB
#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
*/
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...