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

建议使用的浏览器:

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

3462:Date

题目描述
Is it just another problem about year, month and day? No, today we have a more romantic meaning – dating with a girl.
iSea now has a date to be anxious to rush, unfortunately, the city's way is always so complicated, so time goes unconsciously and fast. In order to more quickly rushed to rendezvous, iSea has already drawn a topographic map of this city, he find that the city is composed of a number of equal squares, between the squares, there are some traffic lights controlling the traffic, a basic map example:
Each time, iSea must proceed from the starting point of the upper left corner to reach the lower right corner. The squares’ size is fixed, with a length of two meters and a width of one meter. iSea usually only go across the intersection under the green light, the time he costs is one minute, for safety's sake, in the whole one minute the green light should be lighten, we also know, iSea’s speed along the grid is a constant, one meter per minute.
iSea’s map gives some more specific information about the city, the number of vertical grid N, the number of horizontal grid M, and the time the traffic lights change alternating. In order to simplify the problem, we assume that one day start at 0 hour, traffic lights first allow passengers traverse the intersection from left and right, but block up and down in the intersection, after a time Ti, the traffic lights block left and right to allow access up and down, the time is also the Ti, so the cycle goes.
After simple calculation, iSea finds he may be late for this date, in order to reach the destination in time, he decides to make one exception, in an emergency he would pass through a intersection even if a red light was lighten, but not to loss of too many RP, he asks himself go across the red light at most once, then, can you help him, calculate when he could arrive in rendezvous at the earliest?
输入解释
There are several test cases in the input.

Each test case begin with two integers N, M (1 < N, M ≤ 30), indicating the number of the vertical grid and the horizontal grid.
Then N-1 lines follow, each line contains M-1 numbers Ti (0 < Ti ≤ 10), their meaning is in the description.
The last line is the start time of iSea, in the form of HH:MM.

The input terminates by end of file marker.
输出解释
For each test case, output the earliest time iSea can arrive, in the form of HH:MM, you may assume that all the things happen within the same day
输入样例
2 2
3
12:03
2 3
2 2
12:00
输出样例
12:05
12:05
来自杭电HDUOJ的附加信息
Author iSea @ WHU
Recommend zhouzeyong

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3462

最后修改于 2020-10-25T23:03:48+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
6000/3000MS(Java/Others) 131072/65536K(Java/Others)