DSU
#5
Replies: 1 comment
-
subtasks
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
statement
ให้ list A ของจำนวนเต็ม n ตัว และให้จำนวนเต็มอีก k ตัว
แทรก k ตัวนั้นไปที่ไหนก็ได้ใน A เพื่อสร้าง B
Define f(B, u) เป็นจำนวนของคู่ (u, v) ที่ เมื่อพิจารณา B ในช่วง u ถึง v (หรือ v ถึง u) จะได้ว่าค่ามากสุดของช่วงนั้นอยู่ที่ u
ถามว่า max Sum(f(B, u)) คืออะไร
concept
Sorting + DSU -> O((n+k)log(n+k)) (มั้ง)
Beta Was this translation helpful? Give feedback.
All reactions