Codeforces Round 328 (Div. 2)
E
BCPC
Codeforces
2700
原题
← D→
翻译中…

BCPC stands for Byteforces Collegiate Programming Contest, and is the most famous competition in Byteforces.

翻译中…

BCPC is a team competition. Each team is composed by a coach and three contestants. Blenda is the coach of the Bit State University(BSU), and she is very strict selecting the members of her team.

翻译中…

image

翻译中…

In BSU there are $*n*$ students numbered from 1 to $*n*$. Since all BSU students are infinitely smart, the only important parameters for Blenda are their reading and writing speed. After a careful measuring, Blenda have found that the $*i*$-th student have a reading speed equal to $*r*_{*i*}$ (words per minute), and a writing speed of $*w*_{*i*}$ (symbols per minute). Since BSU students are very smart, the measured speeds are sometimes very big and Blenda have decided to subtract some constant value $*c*$ from all the values of reading speed and some value $*d*$ from all the values of writing speed. Therefore she considers $*r*_{*i*}' = *r*_{*i*} - *c*$ and $*w*_{*i*}' = *w*_{*i*} - *d*$.

翻译中…

The student $*i*$ is said to overwhelm the student $*j*$ if and only if $*r*_{*i*}'·*w*_{*j*}' > *r*_{*j*}'·*w*_{*i*}'$. Blenda doesn’t like fights in teams, so she thinks that a team consisting of three distinct students $*i*, *j*$ and $*k*$ is good if $*i*$ overwhelms $*j*$, $*j*$ overwhelms $*k*$, and $*k*$ overwhelms $*i*$. Yes, the relation of overwhelming is not transitive as it often happens in real life.

翻译中…

Since Blenda is busy preparing a training camp in Codeforces, you are given a task to calculate the number of different good teams in BSU. Two teams are considered to be different if there is at least one student that is present in one team but is not present in the other. In other words, two teams are different if the sets of students that form these teams are different.

翻译中…

Input

翻译中…

In the first line of the input three integers $*n*$, $*c*$ and $*d*$ ($3 ≤ *n* ≤ 345678, 1 ≤ *c*, *d* ≤ 10^{9}$) are written. They denote the number of students Blenda can use to form teams, the value subtracted from all reading speeds and the value subtracted from all writing speeds respectively.

翻译中…

Each of the next $*n*$ lines contains two integers $*r*_{*i*}$ and $*w*_{*i*}$ ($0 < *r*_{*i*}, *w*_{*i*} ≤ 10^{9}, |*r*_{*i*} - *c*| + |*w*_{*i*} - *d*| > 0$). There are no two students, such that both their reading and writing speeds coincide, i.e. for every $*i* ≠ *j*$ condition $|*r*_{*i*} - *r*_{*j*}| + |*w*_{*i*} - *w*_{*j*}| > 0$ holds.

翻译中…

Output

翻译中…

Print the number of different teams in BSU, that are good according to Blenda's definition.

翻译中…

Note

翻译中…

In the first sample the following teams are good: $(*i* = 1, *j* = 2, *k* = 3)$, $(*i* = 2, *j* = 5, *k* = 1)$, $(*i* = 1, *j* = 4, *k* = 3)$, $(*i* = 5, *j* = 1, *k* = 4)$.

翻译中…

Note, that for example the team $(*i* = 3, *j* = 1, *k* = 2)$ is also good, but is considered to be the same as the team $(*i* = 1, *j* = 2, *k* = 3)$.

翻译中…

样例

Input #1
5 2 2
1 1
4 1
2 3
3 2
3 4
Output #1
4
InputCopy OutputCopy
Input #2
7 6 6
3 2
1 7
5 7
3 7
6 4
8 9
8 5
Output #2
11
InputCopy OutputCopy
题目信息
题号
592E
时间限制
4 s
内存限制
256 MB
标签
二分
计算几何
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。