407079: GYM102697 050 The Array Checker-inator!
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
050. The Array Checker-inator!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Given two arrays of integers, check if they are equal... But, if the arrays can be made equal through the removal of duplicates or sorting, they are equal.
InputThe first line will represent the elements, n, in the first array. Then, you will be given n integers inputted on their own lines. After that, another integer will be inputted, which represents the elements, m, in the second array. Then m integers will follow, all being inputted on separate lines.
OutputPrint "YES" (without the quotes) if you these arrays are equal (or if they are equal after removing duplicates and sorting them), or "NO" (without the quotes) if the arrays cannot be made equal.
ExamplesInput3 1 2 3 5 1 1 2 2 3Output
YESInput
4 1 2 3 4 3 1 2 7Output
NO