HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN_114 Midterm A > problem:


5. 51087 - Are they the same?

CEN_114 Midterm A

Start: May.14.2020 at 12:00:01 AM
Finish: May.31.2020 at 11:55:59 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (2)

Contest problems

• 10. 51093 - rgb2gray
• 11. 50410 - Zero Padding
• 12. 50470 - Close Pairs - Revised
• 13. 50735 - Top M Products
• 14. 51094 - Passing the course
• 15. 50804 - Marathon
• 3. 50390 - Total Salary Paid
• 4. 50528 - Rock-Scissors-Paper
• 5. 51087 - Are they the same?
• 6. 51092 - Even and Odd
• 7. 50449 - The biggest result
• 8. 51146 - Popular Baby Names
• 9. 50499 - Table to Row

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Are they the same?

Read two arrays and compare if they have the same items or not. The arrays may be having the items in different orders, or may one array may be having more or less than the other. However, if all elements of the first array appears in the second and all elements of the second array appears in the first array, the arrays are assumed to be the same.

Question: Write a program to read two arrays and decide if the two arrays are the same or not.

Input specification: In the beginning you will be given two integers (m and n). The second line will contain m integers and the third line will contain n integers where 0 ≤ (m and n) ≤ 5,000

Output specification: Show Yes if the two arrays are the same, show No otherwise.

Sample Input I Sample Input II
4 5
1 4 5 3
4 4 3 3 5
7 4
2 2 4 5 5 6 4
2 4 5 6
Sample Output I Sample Output II
No Yes

Explanation: In sample input I, there is 1 in the first array, but it does not exist in the second array.
All the numbers in two arrays appear at least once in two arrays in the second sample.



Для отправки решений необходимо выполнить вход.

www.contester.ru