#K79017. Equal Sum Subsequence
Equal Sum Subsequence
Equal Sum Subsequence
Given two arrays of integers of equal length, determine whether the sum of all elements of the first array is equal to the sum of all elements of the second array.
In this problem, although the wording mentions subsequences, only the sum of the entire arrays is considered. That is, if (\sum_{i=1}^{n}a_i = \sum_{i=1}^{n}b_i), then output YES
; otherwise, output NO
.
Input arrays can include negative and zero values.
inputFormat
The input is given via stdin in the following format:
(n)
(a_1\ a_2\ \ldots\ a_n)
(b_1\ b_2\ \ldots\ b_n)
where (n) is the number of elements in each array, the second line provides (n) space-separated integers for the first array, and the third line provides (n) space-separated integers for the second array.
outputFormat
Output to stdout a single line containing YES
if the sum of the elements in the first array equals that of the second array; otherwise, output NO
.## sample
4
1 2 3 4
5 6 7 8
NO