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

Сборники > Kovrov IT > задача:


50988 - Laplacian Filter

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

Задачи сборника

• 51024 - Total Stock Price
• 51008 - Sum of Regional Maxes
• 51014 - Nine Men's Morris game
• Word Puzzle
• 50740 - Service Time - 1
• 50928 - War Of Battleships
• 50930 - Tom and Jerry
• 50925 - Optimizing Elevator Usage
• 50988 - Laplacian Filter
• 50747 - Safe boxes against thieves
• 50742 - King Arthur II
• 50791 - Mine field
• 50912 - Trip to Librazhd
• Trip to Librazhd
• 50914 - Buy 3, Pay 2
• 50555 - Frekuenca e karaktereve
• 50558 - Hangari i madh [USACO FA...

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

Если у вас есть предложения или пожелания по работе 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