#t242. 日期区间判定

日期区间判定

Date Interval Check

Problem Description

Given two time points and the time an event occurs (all given as year / month / day), determine whether the event time falls between the two time points (inclusive of both endpoints).

Input Format

Three lines, each containing three integers representing year, month, and day in order.

The first two lines are the two time points (it is not guaranteed that the first is earlier than the second). The third line is the time the event occurs. The year is a positive integer greater than 16001600 and less than 1000010000.

Output Format

Output Yes or No, indicating whether the event time lies within the time interval.

Sample Input

2007 1 1
2007 12 31
2007 3 22

Sample Output

Yes

Hint

  • The input is three lines with nine numbers in total; reading them consecutively with cin is unaffected by the line breaks.
  • The two endpoints are not guaranteed to be in order — compare them to find which is earlier before checking the interval. Packing year, month, and day into a single integer (y*10000 + m*100 + d) makes the comparison far more pleasant than three nested ifs.
  • The interval check is inclusive of the endpoints.