Plus Plus
Practice
4 (45 votes)
Basic programming
Basics of implementation
Data types and array handling
Easy
Implementation
Problem
89% Success 7082 Attempts 10 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You are given a two dimensional grid $$A$$ of size $$n \times m$$ ($$n$$ rows and $$m$$ columns). Your task is to select two non overlapping Plus signs from the grid and do multiplication with corresponding elements and find out summation. What is the maximum summation.
Note: The Plus sign will be formed by 5 cells which have coordinates of form $$(x,y)$$, $$(x-1,y)$$, $$(x+1,y)$$, $$(x,y-1)$$, $$(x,y+1)$$. The center of the Plus sign cannot lie on boundary of the grid.Over lapping Plus signs would have atleast one cell in common. Please, see the explanation below for exact figure.
INPUT
- First line contains two space separated integers $$n$$ and $$m$$, denoting size of array $$A$$.
- Next $$n$$ lines contains $$m$$ space separated integers.
OUTPUT
- Print the required maximum value.
Constraints:
- \( 6 \le n, m \le 50\)
- \( 0 \le A(i,j) \le 9\)
Submissions
Please login to view your submissions
Similar Problems
Points:10
27 votes
Tags:
Basic Programming
Points:10
20 votes
Tags:
Basic ProgrammingBasic MathAlgorithmsNumber theory
Points:10
273 votes
Editorial