LCC/Moose '19 Contest 1 S1 - Travel Conflicts

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Nadir is building a travel agent service which recommends potential vacations to clients based on their preference. One of the service's challenges is scheduling conflicts: if a person has booked a vacation, then no future recommendations should overlap with that vacation.

Nadir has asked you to help solve this problem by creating a program that, given two vacations, determines if they overlap.

Input Specification

The input consists of two lines, each describing a vacation. Each line contains four integers Y M D L, where Y M D represent a date earlier than 2030-01-01 and later than 2019-10-01, and L is the duration of the vacation (in days) and is at most 14 days.

Output Specification

Output YES if the vacations overlap; or NO otherwise.

Sample Input 1

2019 10 24 4
2019 10 25 2

Sample Output 1

YES

Sample Input 2

2019 12 30 2
2020 1 1 14

Sample Output 2

NO

Sample Input 3

2020 1 1 14
2019 12 30 3

Sample Output 3

YES

Comments

There are no comments at the moment.