Masking Tape
Xem PDF
Điểm:
1600 (p)
Thời gian:
1.0s
Bộ nhớ:
512M
Input:
bàn phím
Output:
màn hình
You are a publicity agent of the JCIOI. You are ordered to make a signboard to publicize the IOI. The signboard made by painting a rectangle plywood board. The plywood board is bound with some rectangle masking tapes is in advance. So, You decide that you paint each region which is bounded by the masking tapes with different colors.
Write a program which, given a situation of a plywood, determine the minimum number of colors to be able to paint the input plywood with. Here, it is impossible that the entire surface of the plywood is covered by masking tapes, and every side of masking tapes is parallel to one of a side of the plywood.
Input
- The first line contains two integers separated by a single space that represent the size of the given plywood, the width \(w\) (\(1 \le w \le 10^6\)) and the height \(h\) (\(1 \le h \le 10^6\)).
- The second line contains the number \(n\) (\(1 \le n \le 1000\)) of the masking tape on the plywood.
- The \((2 + i)\)-th line (\(1 \le i \le n\)) contains four integers $x_1,y_1, x_2, y_2 $ (\(0 \le x_1 < x_2 \le w,0 \le y_1 < y_2 \le h\)) separated by single spaces. \((x_1, y_1)\) and \((x_2, y_2)\) represent the coordinates of the bottom left corner and the top right corner, respectively, of the i th masking tape on the plywood.
- Note that the coordinates of the bottom left corner of the plywood is (0, 0) and the coordinates of the bottom left corner of it is \((w, h)\).
Output
- Print a single integer, which is the minimum number of colors to be able to paint the input plywood with.

Bình luận