{"problem":{"name":"E. Third-Party Software - 2","description":{"content":"Pavel is developing another game. To do that, he again needs functions available in a third-party library too famous to be called. There are $m$ functions numbered from $1$ to $m$, and it is known tha","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10221E"},"statements":[{"statement_type":"Markdown","content":"Pavel is developing another game. To do that, he again needs functions available in a third-party library too famous to be called. There are $m$ functions numbered from $1$ to $m$, and it is known that the $i$-th version of the library contains functions from $a_i$ to $b_i$ inclusively. \n\nThe library is not free and Pavel needs all the functions. What minimal number of versions does he need to purchase to be able to use all the functions?\n\nThe first line contains two integers $n$ and $m$ ($1 <= n <= 200000, 1 <= m <= 10^9$) — the number of library versions and the number of functions.\n\nEach of the next $n$ lines contains two integers $a_i$ and $b_i$ ($1 <= a_i <= b_i <= m$) — the interval of function numbers available in the $i$-th version.\n\nIn the first line output «_YES_» or «_NO_», depending on if it's possible or not to purchase library versions to use all the functions.\n\nIn case of the positive answer output two more lines. In the second line output a single integer $k$ — the minimal number of library versions needed to be purchased. In the third line output $k$ distinct integers — the numbers of versions needed to be purchased.\n\nIf there are several possible answers, output any of them.\n\n## Input\n\nThe first line contains two integers $n$ and $m$ ($1 <= n <= 200000, 1 <= m <= 10^9$) — the number of library versions and the number of functions.Each of the next $n$ lines contains two integers $a_i$ and $b_i$ ($1 <= a_i <= b_i <= m$) — the interval of function numbers available in the $i$-th version.\n\n## Output\n\nIn the first line output «_YES_» or «_NO_», depending on if it's possible or not to purchase library versions to use all the functions.In case of the positive answer output two more lines. In the second line output a single integer $k$ — the minimal number of library versions needed to be purchased. In the third line output $k$ distinct integers — the numbers of versions needed to be purchased.If there are several possible answers, output any of them.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ N \\in \\mathbb{Z}^+ $ be the number of days.  \nLet $ \\text{day}_0 \\in \\{\\text{Monday}, \\text{Tuesday}, \\text{Wednesday}, \\text{Thursday}, \\text{Friday}, \\text{Saturday}, \\text{Sunday}\\} $ be the name of the first day.  \nLet $ X \\in \\mathbb{Z} $, $ 0 \\leq X \\leq 500 $, be the minimum AQI threshold for suspension.  \nLet $ A = (a_1, a_2, \\dots, a_N) $ be the sequence of AQI values, where $ a_i \\in \\mathbb{Z} $, $ 0 \\leq a_i \\leq 500 $.  \n\nLet $ D = (d_1, d_2, \\dots, d_N) $ be the sequence of day names, where $ d_1 = \\text{day}_0 $ and $ d_{i+1} $ is the next day in weekly cycle.  \n\nLet $ \\text{Weekday} = \\{\\text{Monday}, \\text{Tuesday}, \\text{Wednesday}, \\text{Thursday}, \\text{Friday}\\} $.  \n\n**Constraints**  \n1. $ 1 \\leq N \\leq 10^6 $  \n2. $ 0 \\leq X \\leq 500 $  \n3. $ 0 \\leq a_i \\leq 500 $ for all $ i \\in \\{1, \\dots, N\\} $  \n\n**Objective**  \nCompute:  \n$$\n\\left| \\left\\{ i \\in \\{1, \\dots, N\\} \\mid a_i \\geq X \\text{ and } d_i \\in \\text{Weekday} \\right\\} \\right|\n$$","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10221E","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}