-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBEE-2506.cpp
More file actions
35 lines (24 loc) · 716 Bytes
/
Copy pathBEE-2506.cpp
File metadata and controls
35 lines (24 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
int main()
{
int n {};
const int gap { 30 };
while (std::cin >> n) {
int next_time { 420 };
int reached_critical { 0 };
for (int i = 0; i < n; i++) {
int hour {};
int min {};
int until_critical {};
std::cin >> hour >> min >> until_critical;
int arrived_at = hour * 60 + min;
if (arrived_at > next_time)
next_time = (int) ((arrived_at - 1) / gap + 1) * gap;
if (next_time > arrived_at + until_critical)
reached_critical++;
next_time += gap;
}
std::cout << reached_critical << "\n";
}
return 0;
}