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

Разделы > Поиск > задача:


50535 - Image Compression

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

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

• 50980 - The smallest rectangle
• 50860 - Number of Student Certificates
• 50832 - Rock Paper Scissors Lizard ...
• 50834 - The train which leaves the f...
• 51046 - The biggest number
• 50453 - The Cubic Difference
• 50451 - Processing Cost
• 50538 - Sum of kth Diagonal
• 50535 - Image Compression
• 50470 - Close Pairs - Revised
• 50459 - The Biggest Digit
• 50784 - Top Growing Company
• 50791 - Mine field
• 50867 - Average of the Best Grades
• 50460 - Numrin e Mesem
• 50566 - Mesatarja e pikeve te notav...
• 50573 - Numri dhe shuma

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Image Compression

You want to write an image compression program with the following algorithm. You count the number of occurrences of a number and write the number of occurrences followed by the number itself. e.g. If you have
  77 77 243
  243 243 243
  57 57 57 77 77
you can compress it to:
  2 77 4 243 3 57 2 77
(There are two consecutive 77s, then there are four 243s, etc.)

Question: Write a program that reads an image and prints the compressed version of it.

Input specification
First, you will be given two integers (n,m) where n and m are between 0 and 2000. Then, in the following n lines, you will be given m integers which are between 0 and 255

Output specification
Show the compressed version.

Sample Input I
4 5
84 84 84 126 126
126 32 32 126 126
32 32 32 126 126
126 126 32 32 32
Sample Output I
3 84 3 126 2 32 2 126 3 32 4 126 3 32



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

www.contester.ru