این مسابقه در تاریخ پنج شنبه ۱۴ دی به صورت حضوری در سایت دانشکده برق و کامپیوتر دانشگاه تهران برگزار شد.

C- Painting


  • محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

Erfan wants to draw a painting on an n×mn \times m board. He can draw some strips on the board using a paintbrush of width 11. In each step, he must choose a new color and paint a full column or a full row. He wants to draw an image on the board, but he doesn’t know which color to use first. You must help him find out the order of the colors.

توضیح تصویر

input🔗

There are multiple test cases in the input. The first line of each test case contains two integers nn and mm which indicate the count of rows and columns of the board, respectively Following the first line, there are nn lines with mm integers ci,jc_{i, j}(1in,1jm1 \leq i \leq n, 1 \leq j \leq m) denoting the color in each cell. 1n,m1001 \leq n, m \leq 100 1ci,j10001 \leq c_{i, j} \leq 1000

output🔗

For each test case, write a single line containing the order of colors used to paint the board. If there are several answers, output the one which is lexicographically smallest (considering each number as a symbol).

example🔗

sample input 1🔗

4 4
1 5 4 3
6 5 6 6
2 2 2 2
1 5 4 3
Plain text

sample output 1🔗

1 3 4 6 5 2
Plain text

sample input 2🔗

3 2
1 1
2 3
2 3
Plain text

sample output 2🔗

2 3 1
Plain text
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.