ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Linear Data Structures: Arrays > задача:


51087 - Are they the same?

Гость
• Вопросы к жюри (2)

Задачи раздела

• 51061 - The Longest Path
• 51083 - Grades Histogram
• 51084 - Reflect a matrix
• 51011 - Decoding the Path
• 51088 - Number of letters
• 51172 - The biggest Minute
• 51125 - Filling an Array 3
• 51085 - xyx Divisible by k
• 51087 - Are they the same?
• 51091 - Guess the number - 1
• 51015 - Student Scholarships
• 51008 - Sum of Regional Maxes
• 51020 - Number of nodes removed
• 51141 - Most valuable stock items
• 51014 - Nine Men's Morris game
• 51019 - Finding the hidden message
• 51100 - Minimum time to exit building

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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