当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2097:Drawing Windows

Special Judge 特殊评判
题目描述
Andrew writes portable mailer KittenMail for FTN technology networks. This mailer uses text-mode windowed interface like well-known Norton-style shells do.
Now Andrew wants to write a version of his mailer for the new famous operating system Mycrowslowed Widows Not-tested 0.4. It's easy because there is no so much system-dependent code in the mailer. But the windowing subsystem is based on the module providing system-independent interface to the screen buffer functions.
Andrew wrote the trivial code for Mycrowslowed Widows displaying the contents of the window buffer on the screen. It was easy because the functions are the same as in other operating systems. But he was so surprised when he ran the mailer! Clearing the screen took about a second! Oops. . . What's wrong?
Andrew started to investigate this problem. Few minutes later, he discovered that any Mycrowslowed Widows system call accessing the screen buffer works a huge amount of time --- 1/6000 second or more. It's so awful! What can he do?
After hours of thinking, Andrew decided to make some improvements to his code. Now he wants to use Widows-specific function that draws a rectangle of characters instead of subsequent calls that display only one character. They perfectly work under other operating systems but are very slow under Mycrowslowed Widows. The evident task has arisen. The procedure which redraws window must display its visible parts using the minimal possible number of non-overlapping operations.
It is your task to write the corresponding code for one visible part of the window. Given the part of the rectangular window, write a program which determines the minimal number of non-overlapping rectangles covering this part and finds the optimal way of covering.
输入解释
The visible part of the window is given by its edge containing only horizontal and vertical segments with integer vertex coordinates. The part does not contain holes and its edge does not intersect or touch itself.
Each segment has length of at least one character.
The first line of the input contains the number n of vertices on the edge of the visible part. The next n lines contain coordinates of vertices in counter-clockwise order (y coordinates grow downwards on the screen).
Horizontal and vertical segments alternate in the input. The last segment is drawn between the last and the first vertices. n does not exceed 400 and absolute values of coordinates are limited to 200.
输出解释
In the first line output m --- the minimal number of rectangular regions covering the visible part of the window.
The next m lines must contain one rectangle description each. The rectangle is specified by four numbers:
minimal x, minimal y, maximal x and maximal y.
If there are several optimal solutions, output any of them.
输入样例
12
0 0
0 1
1 1
1 2
2 2
2 1
3 1
3 0
2 0
2 -1
1 -1
1 0
输出样例
3
0 0 1 1
1 -1 2 2
2 0 3 1
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 2000MS

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2097

最后修改于 2020-10-29T06:23:20+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000 64000