Codeforces Round 123 (Div. 2)
D
Analyzing Polyline
Codeforces
1900
原题
← CE →
翻译中…

As Valeric and Valerko were watching one of the last Euro Championship games in a sports bar, they broke a mug. Of course, the guys paid for it but the barman said that he will let them watch football in his bar only if they help his son complete a programming task. The task goes like that.

翻译中…

Let's consider a set of functions of the following form:

翻译中…

image

翻译中…

Let's define a sum of

翻译中…

n

翻译中…

functions

翻译中…

y1(x), ..., yn(x)

翻译中…

of the given type as function

翻译中…

s(x) = y1(x) + ... + yn(x)

翻译中…

for any

翻译中…

x

翻译中…

. It's easy to show that in this case the graph

翻译中…

s(x)

翻译中…

is a polyline. You are given

翻译中…

n

翻译中…

functions of the given type, your task is to find the number of angles that do not equal 180 degrees, in the graph

翻译中…

s(x)

翻译中…

, that is the sum of the given functions.

翻译中…

Valeric and Valerko really want to watch the next Euro Championship game, so they asked you to help them.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ $(1 ≤ *n* ≤ 10^{5})$ — the number of functions. Each of the following $*n*$ lines contains two space-separated integer numbers $*k*_{*i*}, *b*_{*i*}$ $( - 10^{9} ≤ *k*_{*i*}, *b*_{*i*} ≤ 10^{9})$ that determine the $*i*$-th function.

翻译中…

Output

翻译中…

Print a single number — the number of angles that do not equal 180 degrees in the graph of the polyline that equals the sum of the given functions.

翻译中…

样例

Input #1
1
1 0
Output #1
1
InputCopy OutputCopy
Input #2
3
1 0
0 2
-1 1
Output #2
2
InputCopy OutputCopy
Input #3
3
-2 -4
1 7
-5 1
Output #3
3
InputCopy OutputCopy
题目信息
题号
195D
时间限制
2 s
内存限制
256 MB
标签
计算几何
数学
排序

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