Codeforces Beta Round 29(Div. 2,Codeforces 格式)
A
吐口水问题
Spit Problem
Codeforces
1000
原题
←B →

吐口水问题AI (CI翻译)

In a Berland's zoo there is an enclosure with camels. It is known that camels like to spit. Bob watched these interesting animals for the whole day and registered in his notepad where each animal spitted. Now he wants to know if in the zoo there are two camels, which spitted at each other. Help him to solve this task.

在 Berland 的动物园里有一个骆驼围栏。众所周知,骆驼喜欢吐口水。Bob 花了一整天观察这些有趣的动物,并在笔记本上记录了每只动物吐口水的方向。现在,他想知道动物园里是否存在两只互相吐过口水的骆驼。请帮助他解决这个问题。AI (CI翻译)

The trajectory of a camel's spit is an arc, i.e. if the camel in position $*x*$ spits $*d*$ meters right, he can hit only the camel in position $*x* + *d*$, if such a camel exists.

骆驼吐出的口水轨迹是一条弧线,也就是说,如果位于 $*x*$ 位置的骆驼向右吐出 $*d*$ 米,它只能击中位于 $*x* + *d*$ 位置的骆驼(如果这样一只骆驼存在)。AI (CI翻译)

Input

输入格式

AI (CI翻译)

The first line contains integer $*n*$ ($1 ≤ *n* ≤ 100$) — the amount of camels in the zoo. Each of the following $*n*$ lines contains two integers $*x*_{*i*}$ and $*d*_{*i*}$ ($- 10^{4} ≤ *x*_{*i*} ≤ 10^{4}, 1 ≤ |*d*_{*i*}| ≤ 2·10^{4}$) — records in Bob's notepad. $*x*_{*i*}$ is a position of the $*i*$-th camel, and $*d*_{*i*}$ is a distance at which the $*i*$-th camel spitted. Positive values of $*d*_{*i*}$ correspond to the spits right, negative values correspond to the spits left. No two camels may stand in the same position.

第一行包含一个整数 $*n*$($1 ≤ *n* ≤ 100$),表示动物园中骆驼的数量。接下来的 $*n*$ 行中,每行包含两个整数 $*x*_{*i*}$ 和 $*d*_{*i*}$($- 10^{4} ≤ *x*_{*i*} ≤ 10^{4}, 1 ≤ |*d*_{*i*}| ≤ 2·10^{4}$),表示 Bob 笔记本上的记录。$*x*_{*i*}$ 表示第 $*i*$ 只骆驼的位置,$*d*_{*i*}$ 表示第 $*i*$ 只骆驼吐口水的距离。$*d*_{*i*}$ 为正数表示向右吐口水,为负数表示向左吐口水。任意两只骆驼不会站在同一位置。AI (CI翻译)

Output

输出格式

AI (CI翻译)

If there are two camels, which spitted at each other, output YES. Otherwise, output NO.

如果存在两只互相吐过口水的骆驼,输出 YES。否则,输出 NO。AI (CI翻译)

样例

Input #1
2
0 1
1 -1
Output #1
YES
InputCopy OutputCopy
Input #2
3
0 1
1 1
2 -2
Output #2
NO
InputCopy OutputCopy
Input #3
5
2 -10
3 10
0 5
5 -5
10 1
Output #3
YES
InputCopy OutputCopy
题目信息
题号
29A
时间限制
2 s
内存限制
256 MB
标签
暴力

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