Score : 200 points
Problem Statement
Given are two N-dimensional vectors A=(A1,A2,A3,…,AN) and B=(B1,B2,B3,…,BN).
Determine whether the inner product of A and B is 0.
In other words, determine whether A1B1+A2B2+A3B3+⋯+ANBN=0.
Constraints
- 1≤N≤100000
- −100≤Ai≤100
- −100≤Bi≤100
- All values in input are integers.
Input is given from Standard Input in the following format:
N
A1 A2 A3 … AN
B1 B2 B3 … BN
Output
If the inner product of A and B is 0, print Yes
; otherwise, print No
.
2
-3 6
4 2
Yes
The inner product of A and B is (−3)×4+6×2=0.
2
4 5
-1 -3
No
The inner product of A and B is 4×(−1)+5×(−3)=−19.
3
1 3 5
3 -6 3
Yes
The inner product of A and B is 1×3+3×(−6)+5×3=0.