Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 2013-02-21 06:00:00.
Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

CAF - Cafeteria

During the week, the cafeteria of my university is open until 2:30 PM. Normally, I will be at the university before this time anyway. Since I am a lazy person, I don't want to cook for myself and prefer eating in the cafeteria. But sometimes I don't have any classes in the morning, so I have to make sure to get to the university before the cafeteria closes.

There are several bus stops within walking distance of my home and each one has a bus connection to the university. For each bus stop, there will be a bus driving to the university every ten minutes, so I just need to remember the number of minutes after a full hour when the first bus departs from each stop, how long it takes to get to the bus stop and how long the bus needs to drive to the university

Given a sequence of initegers offset (the number of minutes after a full hour when the first bus departs), a sequence of integers walkingTime (the number of minutes I need to walk to a bus stop) and a sequence of integers drivingTime (the number of minutes the bus needs to drive to the university) you should find and print the latest time when I have to leave my house in order to be at the university at 2:30 PM or before. The ith element of offset, walkingTime and drivingTime refers to the ith bus stop.

The format of the time to print should be HH:MM (HH the hour, MM the minute). The 12 hour time format is used.

Times between noon and 1 PM should be written as 12:MM (where MM is the number of minutes after noon).

Input Specification

The input will contain several test cases, each test cases will consist of three lines, the first will contain the offset sequence, the second will contain the walkingTime sequence, and the third will contain the drivingTime sequence. You can assume the follow will always be true:

  • offset, walkingTime and drivingTime contain the same number of elements
  • offset, walkingTime and drivingTime contain between 1 and 50 elements, inclusive.
  • Each element of offset is between 0 and 9, inclusive.
  • Each element of walkingTime is between 1 and 30, inclusive.
  • Each element of drivingTime is between 1 and 300, inclusive.
Output Specification

Print one line per test case with the answer, follow the format below

Input Example
9
1
1
6
9
120
6 9
9 10
120 121
0
20
250
0
21
250
1
30
300
0 1 2 3 4 5 6 7 8 9
11 11 11 11 11 11 11 11 11 11
190 190 190 190 190 190 190 190 190 190
Output Example
02:28
12:17
12:19
10:00
09:59
08:51
11:09

Added by:Fabio Avellaneda
Date:2013-02-02
Time limit:3s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C C++ 4.3.2 CPP JAVA
Public source code since: 2013-02-21 06:00:00

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.