Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
- #define ALL(x) x.begin(),x.end()
- #define SZ(x) x.size()
- #define PB push_back
- #define MP make_pair
- #define F first
- #define S second
- typedef long long LL;
- typedef vector<int> VI;
- typedef pair<int,int> PI;
- int n,s;
- pair<int,int> a[101];
- int m[101];
- int main() {
- io;
- 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;
- cout << x / 60 << " " << x % 60+1;
- return 0;
- }
- }
- int x = m[n-1] + s;
- cout << x / 60 << " " << x % 60 + 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement