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

32921번 - False Alarm 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 2048 MB119886277.500%

문제

Faina is going to sleep, but she needs to wake up early tomorrow for a very important contest. She has already set $n$ alarms at different times between 7:00 and 9:00 in the morning.

However, Faina is a deep sleeper. She knows that in order to wake up, she will need to hear at least three alarms within a 10-minute timespan. In other words, for some three alarms, the difference between the first and the last alarm must be 10 minutes or less.

Faina is not sure if the current set of alarms she has satisfies this condition, and she is worried she might oversleep the contest (and make her teammates angry!). Thus, she wants to set some additional alarms. All new alarms should also be set between 7:00 and 9:00, and all alarms, including the old ones, must be set at different times.

Find the smallest number of additional alarms Faina has to set to be confident that she will wake up. In particular, if she can already be sure she'll wake up, the number of additional alarms is 0ドル$.

입력

The first line contains a single integer $n,ドル denoting the number of alarms Faina has set (1ドル \le n \le 20$).

The $i$-th of the following $n$ lines contains the time of the $i$-th alarm in the h:mm format (7ドル \le \mathtt{h} \le 9$; 00ドル \le \mathtt{mm} \le 59$; if $\mathtt{h} = 9,ドル then $\mathtt{mm} = 00$). The alarms are given in strictly increasing order of time.

출력

Print the smallest number of additional alarms Faina has to set in order to guarantee waking up.

제한

예제 입력 1

5
7:47
7:56
7:59
8:05
8:13

예제 출력 1

0

예제 입력 2

7
8:00
8:10
8:20
8:30
8:40
8:50
9:00

예제 출력 2

1

예제 입력 3

3
7:13
7:41
8:36

예제 출력 3

2

노트

In the first test, three alarms at 7:56, 7:59, and 8:05 guarantee that Faina will wake up.

In the second test, any time between 8:00 and 9:00 that does not coincide with existing alarms works.

In the third test, one possible solution is to set two more alarms at 7:45 and 7:46.

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > ICPC 2024-2025 Northwestern Russia Regional Contest F번

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

출처

대학교 대회

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

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