HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN303_2016Questions > problem:


FE2. 50988 - Laplacian Filter

CEN303_2016Questions

Start: Oct.28.2016 at 05:00:00 PM
Finish: Nov.01.2016 at 05:00:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 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...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

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