TLE '17 Contest 8 P1 - Artificial Intelligence

View as PDF

Submit solution



Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M
Author:

Problem type

Artificial intelligence.

Fax McClad, Croneria's most disruptively innovative bounty hunter, plans to use artificial intelligence in order to track down the Dankey Kang Gang.

But, Fax doesn't know much about the artificial intelligence field, so he decides to hire somebody to do it for him. Luckily, you have been selected for an interview!

Advanced artificial intelligence algorithms require good understanding of linear algebra, so in your interview, Fax asks you some linear algebra questions.

We say that a function T defined on the real numbers is a linear transformation if T(x+y) = T(x) + T(y) and T(cx) = cT(x) for all real x,y,c.

Given N pairs in the form (x,T(x)), Fax wants you to tell him if T could be a linear transformation or not. You have failed several linear algebra exams before, and you definitely don't want to fail this interview. Can you answer Fax's question?

Input Specification

The first line of input will contain N, (1 \le N \le 100\,000), the number of pairs.

N lines of input follow. Each line will contain two integers, representing the pair (x,T(x)). The absolute value of these integers will not exceed 10^6.

For 50\% of the points, N \le 1\,000.

Output Specification

Output yes if T could be a linear transformation, otherwise, output no if it is definitely not.

Sample Input 1

2
1 2
2 4

Sample Output 1

yes

Sample Input 2

3
1 2
2 1
3 5

Sample Output 2

no

Comments