100 atcoder#ABC188B. [ABC188B] Orthogonality

[ABC188B] Orthogonality

Score : 200200 points

Problem Statement

Given are two NN-dimensional vectors A=(A1,A2,A3,,AN)A = (A_1, A_2, A_3, \dots, A_N) and B=(B1,B2,B3,,BN)B = (B_1, B_2, B_3, \dots, B_N). Determine whether the inner product of AA and BB is 00. In other words, determine whether A1B1+A2B2+A3B3++ANBN=0A_1B_1 + A_2B_2 + A_3B_3 + \dots + A_NB_N = 0.

Constraints

  • 1N1000001 \le N \le 100000
  • 100Ai100-100 \le A_i \le 100
  • 100Bi100-100 \le B_i \le 100
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 A3A_3 \dots ANA_N

B1B_1 B2B_2 B3B_3 \dots BNB_N

Output

If the inner product of AA and BB is 00, print Yes; otherwise, print No.

2
-3 6
4 2
Yes

The inner product of AA and BB is (3)×4+6×2=0(-3) \times 4 + 6 \times 2 = 0.

2
4 5
-1 -3
No

The inner product of AA and BB is 4×(1)+5×(3)=194 \times (-1) + 5 \times (-3) = -19.

3
1 3 5
3 -6 3
Yes

The inner product of AA and BB is 1×3+3×(6)+5×3=01 \times 3 + 3 \times (-6) + 5 \times 3 = 0.