Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n,s;
- pair<int,int> a[101];
- int m[101];
- int main() {
- cin >> n >> s;
- for(int i = 0 ; i < n ; i++) {
- cin >> a[i].F >> a[i].S;
- m[i] = a[i].F * 60 + a[i].S;
- }
- if(m[0] > s) {
- cout << "0 0";
- return 0;
- }
- for(int i = 0 ; i < n-1 ; i++) {
- if(m[i+1] - m[i] - 3 >= 2*s ) {
- int x = m[i] + s;
- if(x % 60 + 1 == 60)
- cout << x / 60 + 1 << " 0";
- else
- cout << x / 60 << " " << x % 60+1;
- return 0;
- }
- }
- int x = m[n-1] + s;
- if(x % 60 + 1 == 60)
- cout << x / 60 + 1 << " 0";
- else
- cout << x / 60 << " " << x % 60 + 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement