查看: 1434|回复: 2

Study Room

online_moderator 发表于 2010-4-11 21:09:01 | 显示全部楼层 |阅读模式
All of us like our second main teaching building and always prefer a comfortable seat. To make the following problem easy to handle, we assume there are N rows and M lines of seats in a study room. And we set each seat a singular comfortable value. That means there will not be two seats have same comfortable value. When a student comes into this room, he will choose the empty seat with the maximum comfortable value. However, if there is already a student adjoining to this seat (left or right), he will choose the empty seat with the next maximum comfortable value, until there is nobody at his left and right side.
As you see, if we know all the comfortable values, we can confirm how many students will be in this room. And this is your job.

Input (Please use standard input, and don’t read or write files.)

There are two integers N and M in the first line.
Then follows N lines, each contains M integers. The number on the ith line jth row means the comfortable value of the seat at ith line jth row.

Output (Please use standard output, and don’t read or write files.)

You should output n lines, each contains m characters. 'E' means there is no person on the seat, while 'P' means there is one.
Don't output any blank space and add a black line at end of your output.

Sample Input
3 4
1 2 3 4
5 6 7 8
9 10 11 12

Sample Output

For 30% cases,   0 < N, M <= 40
For 70% cases,   0 < N, M <= 200
For 100% cases,  0 < N, M <= 400


参与人数 1驿站币 +5 收起 理由
56_avatar_small zhaoshengbo + 5 辛苦了


上一篇:Encode and Decode
在线会员 发表于 2010-4-11 22:53:52 | 显示全部楼层
Study Room这英文也太唬人了吧...
ico_lz  楼主| 发表于 2010-4-12 11:15:40 | 显示全部楼层
回复 2# zhaoshengbo

您需要登录后才可以回帖 登录 | 加入驿站 qq_login



站长提醒上一条 /2 下一条

QQ|小黑屋|手机版|VC驿站 ( 辽ICP备09019393号tongdun|网站地图wx_jqr

GMT+8, 2019-7-24 02:31

Powered by Discuz! X3.4

© 2009-2019

快速回复 返回顶部 返回列表