原题链接:http://codeforces.com/problemset/problem/1142/C
题目原文:
C. U2
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Recently Vasya learned that, given two points with different xx coordinates, you can draw through them exactly one parabola with equation of type y=x2+bx+cy=x2+bx+c, where bb and cc are reals. Let's call such a parabola an UU-shaped one.
Vasya drew several distinct points with integer coordinates on a plane and then drew an UU-shaped parabola through each pair of the points that have different xx coordinates. The picture became somewhat messy, but Vasya still wants to count how many of the parabolas drawn don't have any drawn point inside their internal area. Help Vasya.
The internal area of an UU-shaped parabola is the part of the plane that lies strictly above the parabola when the yy axis is directed upwards.
Input
The first line contains a single integer nn (1≤n≤1000001≤n≤100000) — the number of points.
The next nn lines describe the points, the ii-th of them contains two integers xixi and yiyi — the coordinates of the ii-th point. It is guaranteed that all points are distinct and that the coordinates do not exceed 106106 by absolute value.
Output
In the only line print a single integer — the number of UU-shaped parabolas that pass through at least two of the given points and do not contain any of the given points inside their internal area (excluding the parabola itself).
Examples
input
Copy
3 -1 0 0 2 1 0
output
Copy
2
input
Copy
5 1 0 1 -1 0 -1 -1 0 -1 -1
output
Copy
1
Note
On the pictures below all UU-shaped parabolas that pass through at least two given points are drawn for each of the examples. The UU-shaped parabolas that do not have any given point inside their internal area are drawn in red.
The first example.
The second example.
题目大意:
给n个坐标,求能有几个 y = x^2 + bx +c 函数且图像上方没有其它点。
解题思路:
y = x ^ 2 + bx + c 上方没有点,即 y <= x ^ 2 + bx + c,(x, y)是已知的,若把(x, y)看成(a, b),把b看成x,得到 b <= a ^ 2 + ax + c => b - a ^ 2 <= ax + c。那这时候得到的坐标是 y = b - a ^ 2, x = a,在输入时,把坐标y转成 b - a ^ 2,就可以把问题看成y <= ax + c 来看,这样所有其余点在直线下方就可以很容易想到凸包求解。
AC代码:
未完成