#P6541. Neko and triangle
Neko and triangle
Problem Description
Neko haves a sequence with $n$ points, the $i$-th point is $A_{i}$. And she gets $m$ key points.
Define the origin point is $O = (0,0)$.
For each key point $P_{k}$, you need to find a interval $[l, r]$ to make $\sum_{i = l} ^ {r} S_{i}$ max. $S_{i}$ is the directed area of triangle $\triangle OP_{k}A_{i}$. There may be a lot of intervals suitable, so you only need output the sum of area.
Input
The first line contains two integers $n, m(1 \leq n,m \leq 10^{5})$
The next $n$ line, each line contains two integers $x, y(0 \leq x,y \leq 10^{5})$, means the coordinate of the $i$-th point $A_{i}$.
The next $m$ line, each line contains two integers $x, y(0 \leq x,y \leq 10^{5})$, means the coordinate of the $i$-th key point $P_{i}$.
Output
For each key point, output the max area in one line. For convenience, please output twice the area.
4 4
1 3
2 4
3 2
4 3
1 1
2 2
3 3
4 4
4
8
12
16