Logo
(追記) (追記ここまで)

3235번 - TRAJEKT 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB49292156.757%

문제

Towns A and B are connected with a ferry line.

We know the legth of the ferry ride, the minimal boarding time (needed for unloading and loading), and the times of the ferry departures from the both towns.

You have to write a program that will calculate the minimal number of ferries needed to keep the schedule.

Note: the ferries ride only by the schedule, that is the ferry cant't ride if it is not their daeparture time.

입력

First line of the input file consists of two integers K and L divided by a single space, 1 ≤ K,L ≤ 1000, the legth of the ferry ride between the two towns and the minimal boarding time (in minutes).

The next line consists of an integer A, 1 ≤ A ≤ 1440, number of departures from the town A. The next A lines consist of departure times from town A.

The next line consists of an integer B, 1 ≤ B ≤ 1440, number of departures from the town B. The next B lines consist of departure times from town B.

All departure times for a town are given in chronological order and written in the HH:MM format (hours and minutes). If the minutes or the hour of the departure time are a one digit number, they will be preceeded by a leading zero.

The times are between 00:00 and 23:59.

출력

The first and the only line of the output file should consist of the minimal number of ferries needed to keep the schedule.

제한

예제 입력 1

30 15
1
08:00
1
08:00

예제 출력 1

2

예제 입력 2

15 30
2
08:00
12:00
1
08:45

예제 출력 2

1

예제 입력 3

90 30
2
09:00
10:00
4
08:00
11:00
14:00
20:00

예제 출력 3

3

힌트

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2003 > National Competition #1 - Juniors 2번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /