electicode
HomeCoursesResourcesProblemsNational OlympiadContestsLeaderboard
...

Are the arrays equal?

Time Limit: 1000msMemory Limit: 256MB
View Submissions

Problem Description

You are given two arrays aaa and bbb of the same size. Print "YES" if the arrays aaa and bbb are equal to each other, and "NO" otherwise.

Input Format

The first line contains one integer nnn - the number of elements in the arrays aaa and bbb (1≤n≤105)(1 \le n \le 10^5)(1≤n≤105).

The second line contains nnn integers a1,a2,…,ana_1, a_2, \dots, a_na1​,a2​,…,an​ - the elements of array .

The third line contains nnn integers b1,b2,…,bnb_1, b_2, \dots, b_nb1​,b2​,…,bn​ - the elements of array .

Output Format

Print "YES" if the arrays are equal to each other, and "NO" otherwise.

Examples

Example 1
Input
3
1 2 3
4 3 9
Output
NO
Example 2
Input
3
20 2 5
20 2 5
Output
YES

© 2026 Electicode. All rights reserved.

aa
a
(1≤ai≤109)(1 \le a_i \le 10^9)(1≤ai​≤109)
bb
b
(1≤bi≤109)(1 \le b_i \le 10^9)(1≤bi​≤109)