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

Турниры > CEN303_2016Questions > задача:


FE2. 50988 - Laplacian Filter

CEN303_2016Questions

Старт: 28.окт.2016 в 17:00:00
Финиш: 01.ноя.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

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

Задачи турнира

• FE1. 51076 - Key person
• FE2. 50988 - Laplacian Filter
• FE3. 51075 - Shortest Path for Bishop
• HW011. 51008 - Sum of Regional M...
• HW012. 51009 - Sum of the nth row
• HW021. 51011 - Decoding the Path
• HW022. 51012 - Palindrome-k
• HW023. 50741 - DNA Distance
• HW031. 51015 - Student Scholarships
• HW032. 51014 - Nine Men's Morris g...

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
CEN112 Questions 2016 15-FE-5.

Laplacian Filter

In image processing, Laplacian filter is used as sharpening spatial filter. In a 2D array, the value of current position is calculated as

D(i ,j) = 4 * D(i,j) - (Sum of 4 neighbors)
Assume that any neighbor of D(i,j) which is out of border has the same value as D(i,j).

Question: You will be given a 2D array and then you will also be given k coordinates. Show the values of cells on the given k coordinates.
Hint: Do not change the value of the cell.

Input specification: First, you will be given two integers: the height (n) and width (m) of 2D matrix. The following n lines contain m integers which are between 0 and 255. On the next line, you will be given one integer (k). On the following k lines you will be given (x,y) coordinates of k cells where 1 ≤ (n,m, and k) ≤ 100.

Output specification: Show k integers.

Sample Input
5 5
2 6 6 6 1
5 4 6 3 4
1 6 2 5 4
3 2 3 7 4
3 4 1 1 7
3
2 2
1 5
4 4
Sample Output
-7
-1
15



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

www.contester.ru