AlgoUniversity
  • Go Back
Discussion
Boring Array :

Author

Akshay Sharma

Difficulty Level : Easy

Submissions : 125

Asked In : ByteDance

Marks :100

: 1 | : 0

Array operations are boring and fun.

You are given an array of integers ($$$a_i,a_{i+1}..........a_{n-1}$$$) and ($$$b_i,b_{i+1}.......b_{n-1}$$$).Lets define a transformation of array a: Choose any non negative integer k such that ($$$0 \le k \le n $$$),Choose k distinct indices ($$$1 < i_1 < i2 .....< i_k \le n$$$). Add 1 to each ($$$a_{i1},a_{i2}....a_{ik}$$$) all other elements of array a remains unchanged . Permute elements of the array a in any order.

Is it possible to perform some transformation of the array exactly once, So the resulting array is equal to b?

If it is possible then print YES else print NO

Input

The first line of the test case contains an integer N ($$$1 \le n \le 1e5 $$$)the length of arrays A and B.

The next line contains n spaced integers of array A that is ($$$a_i,a_{i+1}.......a_{n-1}$$$).

The next line contains n spaced integers of array B that is ($$$b_i,b_{i+1}......b{n-1}$$$).

Output

For each test case print Yes or No if it is possible to make array A equal to array B or not.

Examples

Input
5
1 2 3 4 5
5 1 1 3 4
Output
NO
Input
3 
1 2 3
2 3 4
Output
YES

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.