A New Scheduler


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 256M

Problem types

You are given a list of task schedules that should be run on a multi-core CPU. Each task takes one CPU slice but should be executed in the specified time range. Knowing the number of cores in the new CPU model, can you make a scheduler that will optimally allocate CPU cores to tasks so that all tasks are executed or report that it is impossible?

Input Specification

The first line of input contains two numbers \(1 \leq N \leq 1000\) number of tasks and \(1 \leq C \leq 100\) the number of CPU cores.

\(N\) lines follow, each line contains two integers \(1 \leq s_i \leq e_i \leq 100\) the time range (in quantum) where we can execute task \(i\).

Output Specification

If we can run every task within the given constraints print \(Yes\) otherwise, print \(No\).

Sample Input

4 3
1 2
2 3
2 3
1 1

Sample Output

Yes

Sample Input

4 1
1 2
2 3
2 3
1 1

Sample Output

No

Notes

A CPU core can only execute \(**at most one**\) single task in a given slice.


Comments


  • 0
    YassirSalama  commented on May 12, 2023, 2:38 p.m.

    Any idea why i'm getting wa on the 3rd case.