310. Same Values, Different Order
Print Yes if the two lists contain exactly the same values with the same
multiplicities, in any order. Print No otherwise.
1 1 2 and 1 2 2 are NOT permutations of each other: both have three
values and two distinct ones, and the counts differ.
Count the values in the first list, then walk the second decrementing. If any count goes negative, or anything is left over, the answer is No. Comparing lengths first rules out the easy case immediately.
Constraints - `1 ≤ n ≤ 200000` - `1 ≤ m ≤ 200000` - `-1000000000 ≤ values ≤ 1000000000`
Input
The first line contains two integers n and m.
The second line contains n integers, the third contains m integers.
Output
Print Yes or No on one line.
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.