시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 128 MB 1636 723 613 46.369%

문제

코레스코 콘도미니엄 8층은 학생들이 3끼의 식사를 해결하는 공간이다. 그러나 몇몇 비양심적인 학생들의 만행으로 음식물이 통로 중간 중간에 떨어져 있다. 이러한 음식물들은 근처에 있는 것끼리 뭉치게 돼서 큰 음식물 쓰레기가 된다. 

이 문제를 출제한 선생님은 개인적으로 이러한 음식물을 실내화에 묻히는 것을 정말 진정으로 싫어한다. 참고로 우리가 구해야 할 답은 이 문제를 낸 조교를 맞추는 것이 아니다. 

통로에 떨어진 음식물을 피해가기란 쉬운 일이 아니다. 따라서 선생님은 떨어진 음식물 중에 제일 큰 음식물만은 피해 가려고 한다. 

선생님을 도와 제일 큰 음식물의 크기를 구해서 “10ra"를 외치지 않게 도와주자.

입력

첫째 줄에 통로의 세로 길이(N<=100)과 가로길이(M<=100) 그리고 음식물 쓰레기의 개수(K<=10,000)이 주어진다.  그리고 다음 K개의 줄에 음식물이 떨어진 좌표가 주어진다.

출력

첫째 줄에 음식물중 가장 큰 음식물의 크기를 출력하라.

예제 입력 1

3 4 5
3 2
2 2
3 1
2 3
1 1

예제 출력 1

4

힌트

# . . .
  . # # .
  # # . .
위와 같이 음식물이 떨어져있고 제일큰 음식물의 크기는 4가 된다. (인접한 것은 붙어서 크게 된다고 나와 있음. 대각선으로는 음식물 끼리 붙을수 없고 상하좌우로만 붙을수 있다.)

W3sicHJvYmxlbV9pZCI6IjE3NDMiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM3NGNcdWMyZGRcdWJiM2MgXHVkNTNjXHVkNTU4XHVhZTMwIiwiZGVzY3JpcHRpb24iOiI8cD5cdWNmNTRcdWI4MDhcdWMyYTRcdWNmNTQgXHVjZjU4XHViM2M0XHViYmY4XHViMmM4XHVjNWM0IDhcdWNlMzVcdWM3NDAgXHVkNTU5XHVjMGRkXHViNGU0XHVjNzc0IDNcdWIwN2NcdWM3NTggXHVj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