PaintingProblem code: PAINT |
All submissions for this problem are available.
Leonardo da Vinci is preparing the background for his new painting. Since this is the computer age, he is using an electronic paper which is initially white. Paper is a MxN rectangular gird having MxN square cells. With paint(i,j) operation, his computer fills the cell(i,j) of the paper with black color. However, at any point in time, he may want to know the size of biggest black segment. Black Segment is defined as the group of cells in which any two vertical or horizontal neighboring cells are black. He asks for your help to complete the above task. The first line contains two integers, M and N. Next line contains an integer Q, where Q is total number of queries. The following Q lines each have a query Qi containing an integer B. B is either 0 or 1. If B is 1, two integers i and j follow which corresponds to the operation paint(i,j) (1-based index). For every query with B=0, output the size of biggest black segment.Input
Output
Example
Input:
3 3
9
1
2 1
0
1
1 3
0
1
3 3
1
2 3
0
1
2 2
0
Output:
1
1
3
5
Figure from Example.
Constraints:
| Author: | divij |
| Date Added: | 30-09-2010 |
| Time Limit: | 2 sec |
| Source Limit: | 50000 Bytes |
| Languages: | C, C99 strict, CLOJ, CPP 4.0.0-8, CPP 4.3.2, F#, GO, PERL6, PYTH 3.1.2, TEXT |
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
