Easy Problem Once More

Time Limit: 2000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 4795
64-bit integer IO format: %I64d      Java class name: Main

Description

Define matrix , if for every m(1 ≤ m ≤ n),

then matrix A can be called as partially negative matrix. Here matrix
, and {i1,..,im} is a sub set of {1,..,n}.If you are not familiar with determinant of a matrix, please read the Note part of this problem.
For example, matrix is a partially negative matrix because |-2|, |-6| andare negative.
A symmetric matrix is a square matrix that equals to its transpose. Formally, matrix A is symmetric if A = AT. For example, is a symmetric matrix.
Given two N-dimensional vector x and b, and we guarantee that there will be at least
one 0 value in vector b. You task is to judge if there exists a symmetric partially
negative matrix A, which fulfills Ax = b.

Input

There are several test cases. Proceed to the end of file.
Each test case is described in three lines.
The first line contains one integer N (2 ≤ N ≤ 100000) .
The second line contains N integers xi (-1000000 < xi < 1000000, 1 ≤ i ≤ N), which is vector x.
The third line contains N integers bi (-1000000 < bi < 1000000, 1 ≤ i ≤ N), which is vector b. There will be at least one bi which equals to zero.

Output

For each test case, output “Yes” if there exists such a matrix A, or “No” if there is no such matrix.

Sample Input

2
2 1
0 6

Sample Output

Yes

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .