F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Neko and triangle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 132    Accepted Submission(s): 1


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.
 

Sample Input
4 4 1 3 2 4 3 2 4 3 1 1 2 2 3 3 4 4
 

Sample Output
4 8 12 16
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-25 22:09:18, Gzip enabled