problem link:https://szkopul.edu.pl/problemset/problem/2yK6zUTXvAjhxSDfbjE4Zx7k/site/?key=statement how to solve this problem?
problem link:https://szkopul.edu.pl/problemset/problem/2yK6zUTXvAjhxSDfbjE4Zx7k/site/?key=statement how to solve this problem?
Изначально у вас есть пустое множество прямых. Вам нужно обработать n запросов. Запросы могут быть такими:
• + k b — добавить прямую с уравнением y = kx + b.
• − k b — удалить прямую с уравнением y = kx+b. Гарантируется, что такая прямая существует.
• ? q — Найти количество прямых, которые пересекают прямую y = q в целочисленной точке x. (т.е те прямые для которых уравнение kx + b = q имеет целочисленное решение).(n,q,x,k<=3*10^5)
how to solve this problem:
given a n — numbers of players and their height h_i. You need to split to k teams that the incompatibility is minimal. Incompatibility is the sum of the mx(maximum height of team player)-h_i(height of other player)
n <= 10^5
k <= min(n,20)
h_i <= 10^6