← 返回 pinterest 的题目列表Compare Two Sets for Equality
类型:online_judge
Given two sets of integers, determine whether they contain exactly the same elements.
Each set contains no duplicate elements, and element order does not matter. Output true if the two sets have the same elements and the same number of elements; otherwise, output false.
Input Format
First line: integer n, the number of elements in the first set.
Second line: n integers for the first set; this line is empty when n = 0.
Third line: integer m, the number of elements in the second set.
Fourth line: m integers for the second set; this line is empty when m = 0.
Output Format
Print true or false.
Constraints
0 <= n, m <= 100,000
Element values are in [-10^9, 10^9]
Example 1
Input:
3
1 2 3
3
3 2 1
Output:
true
Example 2
Input:
3
1 2 3
2
1 2
Output:
false
Example
Input
3
1 2 3
3
3 2 1
Output
true