cheran-senthil / PyRival

⚡ Competitive Programming Library
https://pyrival.readthedocs.io/
Apache License 2.0
1.15k stars 311 forks source link

Convex hull trick #38

Closed bjorn-martinsson closed 4 years ago

bjorn-martinsson commented 4 years ago

Convex hull trick is a well known technique. The issue is people want to use it for different reasons. Either you want

  1. Integral precision. Where the coefficients are integral and every query is integral, and you want an exact answer.
  2. Floating point precision.

So I made the convex_hull_trick have 2 modes. By default it uses integral precision, but you can also make it work with floating point numbers simply doing integer = False.

cheran-senthil commented 4 years ago

LGTM