#C3739. Matching Stock Levels

    ID: 47199 Type: Default 1000ms 256MiB

Matching Stock Levels

Matching Stock Levels

You are given two lists of integers: the current stock levels s and the target stock levels t. In one move, you are allowed to swap any two items in the list s. Determine if it is possible to transform the list s into the list t using any sequence of such swap operations.

Note: Swapping does not change the multiset of elements. Therefore, it is possible to match the stock levels if and only if the multisets of s and t are identical. In mathematical terms, you must check whether

\( \text{sorted}(s) = \text{sorted}(t) \).

inputFormat

The input is read from stdin and has the following format:

  1. An integer N representing the number of elements in each list.
  2. A line containing N space-separated integers representing the current stock levels s.
  3. A line containing N space-separated integers representing the target stock levels t.

outputFormat

Output a single line to stdout containing True if it is possible to match the stock levels by swapping, and False otherwise.

## sample
5
5 1 3 2 4
3 2 1 5 4
True

</p>