-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisks2.cpp
More file actions
36 lines (28 loc) · 737 Bytes
/
disks2.cpp
File metadata and controls
36 lines (28 loc) · 737 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
// insert brief description of the solution here
// NOTE: it is recommended to use this even if you don't understand the following code.
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main() {
// uncomment the following lines if you want to read/write from files
// ifstream cin("input.txt");
// ofstream cout("output.txt");
int N, T;
cin >> N >> T;
vector<int> A(N), B(N);
for (int i = 0; i < N; i++) {
cin >> A[i] >> B[i];
}
// insert your code here
int ans = -1;
for (int i=1; i<N; i++) {
int time = A[i] + (24-B[i-1]);
if (time >=T) {
ans = i-1;
break;
}
}
cout << ans << endl; // print the result
return 0;
}