Squash the BugsProblem code: B5 |
All submissions for this problem are available.
This problem was part of the CodeChef April Challenge. All user submissions for this contest problem are publicly available here.
Bugs have gotten into The Chef’s kitchen! Help him trap them all and he’ll make you a batch of his famous chocolate chip cookies. You are given a given a square map of the kitchen divided into tiles, and in each tile sits some known number of bugs. You also have a square trap, which can be dropped to cover a certain number of tiles (the trap may only cover tiles from within the map, and must be aligned to the borders of the kitchen). However, the trap only catches bugs from one of the tiles which it has covered, having a minimum number of bugs on it. For all possible positions at which the trap can be dropped, determine number of bugs that will be caught.
Input
Two numbers, 0< n <= 1000 (size of the map), and 0< k <= n (size of the trap), followed by n rows with n numbers, determining the number of bugs on each tile. The number of bugs on each tile will fit in an signed 32-bit integer.
Output
You should output n-k+1 rows with n-k+1 numbers in each row.
Example
Input: 4 2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 0 Output: 0 1 2 4 0 0 2 0 0
| Author: | admin |
| Date Added: | 15-03-2009 |
| Time Limit: | 2 - 4 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions

if k==0 what is the result
if k==0 what is the result ???
The input section clearly
The input section clearly says k > 0..
in the right side the every
in the right side the every accepted solution has taken time>4s
still they r accepted why????????????????
FAQ
FAQ
I am getting runtime error
I am getting runtime error (nzec) with my python code submission. could someone help me out in understanding this error and its possible cases? thanks.