荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: huhaiming (一生只爱她), 信区: Program
标  题: problem F
发信站: 荔园晨风BBS站 (Sat May 24 20:07:01 2003), 站内信件


Bookshelf Demo


Time limit: 1 Seconds   Memory limit: 32768K
Total Submit: 0   Accepted Submit: 0

------------------------------------------------------------------------
--------

The new semester starts and Polivic's girlfriend has bought a
bookshelf but
since she has got so many books and things are in a mess. Of course,
Polivic
is always willing to help.

He wants to illustrate what the bookshelf will look like. As photoshop
never
touches his mind, ASCII is the solution.




Input

There are multiple tests. Each case starts with two integers W and L:

W (width of the bookshelf)

L (levels of the bookshelf)

The following L lines describe each level in the form:

Hi (height of this level) Ni (number of books in this level), followed
by 2Ni
integers for height and width of each book.

A case with W = 0 signals the end of input and this case shall not be
processed.


Output

Print each bookshelf followed with a blank line.

Notice that:

1) The top and bottom of the bookself is of one unit height, and two
unit
wider than the rest levels.

2) On each level the books are arranged from the left-most in the
order of
input.

3) The input is always legal.


Sample Input

20 2
5 2 2 1 4 2
3 1 2 2
0


Sample Output

(Refer to the image.)


Author: ZHENG, Jianqiang



------------------------------------------------------------------------
--------

Submit   Back   Status

------------------------------------------------------------------------
--------

Zhejiang University Online Judge V1.0
--

菩提本无树,明镜亦非台

本来无一物,何处惹尘埃

※ 来源:·荔园晨风BBS站 bbs.szu.edu.cn·[FROM: 192.168.0.200]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店