#K9571. Project Deadline Completion
Project Deadline Completion
Project Deadline Completion
In this problem, you are given n projects. Each project is characterized by a deadline and a set of resource availability days. A project can be completed if, and only if, every required resource is available on or before its deadline. Mathematically, for each project with deadline \(d\) and resource availability days \(d_i\), the condition \(d_i \leq d\) must be satisfied for all resources.
Your task is to determine whether all projects can be completed on time.
inputFormat
The input begins with a single integer n \( (1 \le n \le 10^5)\), representing the number of projects.
Each of the following n lines describes a project in the format:
deadline resources_count resource1 resource2 ... resource_k
Here, deadline
is an integer indicating the project's deadline day, resources_count
(denoted by \(k\)) is the number of required resources, followed by \(k\) integers indicating the availability days of the respective resources. All values are separated by spaces.
outputFormat
Output a single line containing YES
if all projects can be completed by their deadlines; otherwise, output NO
.
3
10 2 3 5
15 3 1 1 14
20 1 19
YES