-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicpc2594.cpp
More file actions
38 lines (35 loc) · 838 Bytes
/
icpc2594.cpp
File metadata and controls
38 lines (35 loc) · 838 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
35
36
37
38
#include <iostream>
#include <climits>
#include <vector>
#include <algorithm>
using namespace std;
using pint = pair<int, int>;
int toTime(int k){
int h = k / 100;
int m = k % 100;
return h * 60 + m;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, answer = 0, last = 600;
vector<pint> rides;
cin >> n;
rides.resize(n + 1);
for(int i = 0; i < n; i++){
int k;
cin >> k;
rides[i].first = toTime(k) - 10;
cin >> k;
rides[i].second = toTime(k) + 10;
}
rides[n] = pint(1320, INT_MAX);
sort(rides.begin(), rides.end());
for(int i = 0; i < rides.size(); i++){
answer = max(answer, rides[i].first - last);
last = max(last, rides[i].second);
}
cout << answer << endl;
return 0;
}