{"problem":{"name":"H. Pavel's Party","description":{"content":"Pavel is going to have a party, and he wants to invite exactly k people. Pavel has n friends and he has already decided in what order he is going to call and invite them. When Pavel calls the i-th fr","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10097H"},"statements":[{"statement_type":"Markdown","content":"Pavel is going to have a party, and he wants to invite exactly k people.\n\nPavel has n friends and he has already decided in what order he is going to call and invite them. When Pavel calls the i-th friend, he tells he will come if from ai to bi people come to the party.\n\nOnce the required number of people is assembled, Pavel invites them and the party is arranged. Pavel won't call the rest friends.\n\nFor every k = 1, ..., n find the number of people whom Pavel will call.\n\nThe first line contains a single integer n (1 ≤ n ≤ 200000) — the number of Pavel's friends.\n\nEach of the next n lines contains two integers ai and bi (1 ≤ ai ≤ bi ≤ n) — the lower and the upper bound of the invited people required for the i-th Pavel's friend to come.\n\nThe data is listed in the order Pavel will get to know it.\n\nOutput n space-separated integers. The k-th number should be equal to the number of friends called by Pavel if he wants to invite exactly k people to the party. If for some k the party cannot be arranged, output  - 1 for this k.\n\n## Input\n\nThe first line contains a single integer n (1 ≤ n ≤ 200000) — the number of Pavel's friends.Each of the next n lines contains two integers ai and bi (1 ≤ ai ≤ bi ≤ n) — the lower and the upper bound of the invited people required for the i-th Pavel's friend to come.The data is listed in the order Pavel will get to know it.\n\n## Output\n\nOutput n space-separated integers. The k-th number should be equal to the number of friends called by Pavel if he wants to invite exactly k people to the party. If for some k the party cannot be arranged, output  - 1 for this k.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of friends.  \nFor each $ i \\in \\{1, \\dots, n\\} $, let $ [a_i, b_i] \\subseteq \\mathbb{Z}^+ $ be the interval such that friend $ i $ will attend if the total number of attendees is in $ [a_i, b_i] $.  \n\n**Constraints**  \n1. $ 1 \\leq n \\leq 200000 $  \n2. For all $ i \\in \\{1, \\dots, n\\} $, $ 1 \\leq a_i \\leq b_i \\leq n $  \n\n**Objective**  \nFor each $ k \\in \\{1, \\dots, n\\} $, compute the smallest index $ p \\in \\{1, \\dots, n\\} $ such that exactly $ k $ friends among the first $ p $ satisfy $ a_i \\leq k \\leq b_i $, and no friend beyond $ p $ is called. If no such $ p $ exists, output $ -1 $.  \n\nFormally, for each $ k \\in \\{1, \\dots, n\\} $:  \n$$\n\\text{answer}[k] = \\min \\left\\{ p \\in \\{1, \\dots, n\\} \\ \\middle| \\ \\left| \\left\\{ i \\in \\{1, \\dots, p\\} \\mid a_i \\leq k \\leq b_i \\right\\} \\right| = k \\right\\}\n$$  \nIf the set is empty, $ \\text{answer}[k] = -1 $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10097H","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}