{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003ch2\u003eProblem I\n \n \u003c/h2\u003e\n\n\u003cp\u003e\n Jim, working for a railroad company, is responsible for planning a new tourist train service. He is sure that the train route along a scenic valley will arise a big boom, but not quite sure how big the boom will be.\n\u003c/p\u003e\n\n\u003cp\u003e\n A market survey was ordered and Jim has just received an estimated list of passengers\u0027 travel sections. Based on the list, he\u0027d like to estimate the minimum number of train seats that meets the demand.\n\u003c/p\u003e\n\n\u003cp\u003e\n Providing as many seats as all of the passengers may cost unreasonably high. Assigning the same seat to more than one passenger without overlapping travel sections may lead to a great cost cutback.\n\u003c/p\u003e\n\n\u003cp\u003e\n Two different policies are considered on seat assignments. As the views from the train windows depend on the seat positions, it would be better if passengers can choose a seat. One possible policy (named `policy-1\u0027) is to allow the passengers to choose an arbitrary seat among all the remaining seats when they make their reservations. As the order of reservations is unknown, all the possible orders must be considered on counting the required number of seats.\n\u003c/p\u003e\n\n\u003cp\u003e\n The other policy (named `policy-2\u0027) does not allow the passengers to choose their seats; the seat assignments are decided by the railroad operator, not by the passengers, after all the reservations are completed. This policy may reduce the number of the required seats considerably.\n\u003c/p\u003e\n\n\u003cp\u003e\n Your task is to let Jim know how di\u0026#xb;erent these two policies are by providing him a program that computes the numbers of seats required under the two seat reservation policies. Let us consider a case where there are four stations, S1, S2, S3, and S4, and four expected passengers $p_1$, $p_2$, $p_3$, and $p_4$ with the travel list below.\n\u003c/p\u003e\n\n\u003ccenter\u003e\n\u003ctable\u003e\n \u003ctbody\u003e\u003ctr\u003e\n \u003cth width\u003d\"120\"\u003epassenger\u003c/th\u003e\n \u003cth width\u003d\"120\"\u003efrom\u003c/th\u003e\n \u003cth width\u003d\"120\"\u003eto\u003c/th\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e$p_1$\u003c/td\u003e\n \u003ctd\u003eS1\u003c/td\u003e\n \u003ctd\u003eS2\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e$p_2$\u003c/td\u003e\n \u003ctd\u003eS2\u003c/td\u003e\n \u003ctd\u003eS3\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e$p_3$\u003c/td\u003e\n \u003ctd\u003eS1\u003c/td\u003e\n \u003ctd\u003eS3\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd\u003e$p_4$\u003c/td\u003e\n \u003ctd\u003eS3\u003c/td\u003e\n \u003ctd\u003eS4\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\u003c/center\u003e\n\u003cbr\u003e\n\n\n\u003cp\u003e\n The travel sections of $p_1$ and $p_2$ do not overlap, that of $p_3$ overlaps those of $p_1$ and $p_2$, and that of $p_4$ does not overlap those of any others.\n\u003c/p\u003e\n\n\u003cp\u003e\n Let\u0027s check if two seats would suffice under the policy-1. If $p_1$ books a seat first, either of the two seats can be chosen. If $p_2$ books second, as the travel section does not overlap that of $p_1$, the same seat can be booked, but the other seat may look more attractive to $p_2$. If $p_2$ reserves a seat different from that of $p_1$, there will remain no available seats for $p_3$ between S1 and S3 (Figure I.1).\n\u003c/p\u003e\n\n\u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/be564c132447ff921f34f98efba68299?v\u003d1714748019\" width\u003d\"600\"\u003e\n \u003cp\u003eFigure I.1. With two seats\u003c/p\u003e\n\u003c/center\u003e\n\n\u003cp\u003e\n With three seats, $p_3$ can find a seat with any seat reservation combinations by $p_1$ and $p_2$. $p_4$ can also book a seat for there are no other passengers between S3 and S4 (Figure I.2).\n\u003c/p\u003e\n\n\u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/7765f1af39bef21723529fa771bc0425?v\u003d1714748019\" width\u003d\"600\"\u003e\n \u003cp\u003eFigure I.2. With three seats\u003c/p\u003e\n\u003c/center\u003e\n\n\u003cp\u003e\n For this travel list, only three seats suffice considering all the possible reservation orders and seat preferences under the policy-1.\n\u003c/p\u003e\n\n\u003cp\u003e\n On the other hand, deciding the seat assignments after all the reservations are completed enables a tight assignment with only two seats under the policy-2 (Figure I.3).\n\u003c/p\u003e\n\n\u003ccenter\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/4b7314904ecce458bc14c9b9aa2fe9a5?v\u003d1714748019\" width\u003d\"600\"\u003e\n \u003cp\u003eFigure I.3. Tight assignment to two seats\u003c/p\u003e\n\u003c/center\u003e\n\n\u003ch3\u003eInput\u003c/h3\u003e\n\u003cp\u003e\n The input consists of a single test case of the following format.\n\u003c/p\u003e\n\n\u003cpre\u003e$n$\n$a_1$ $b_1$\n...\n$a_n$ $b_n$\n\u003c/pre\u003e\n\n\u003cp\u003e\n Here, the first line has an integer $n$, the number of the passengers in the estimated list of passengers\u0027 travel sections ($1 \\leq n \\leq 200 000$). The stations are numbered starting from 1 in their order along the route. Each of the following $n$ lines describes the travel for each passenger by two integers, the boarding and the alighting station numbers, $a_i$ and $b_i$, respectively ($1 \\leq a_i \u0026lt; b_i \\leq 100 000$). Note that more than one passenger in the list may have the same boarding and alighting stations.\n\u003c/p\u003e\n\n\u003ch3\u003eOutput\u003c/h3\u003e\n\n\u003cp\u003e\n Two integers $s_1$ and $s_2$ should be output in a line in this order, separated by a space. $s_1$ and $s_2$ are the numbers of seats required under the policy-1 and -2, respectively.\n\u003c/p\u003e\n\n\n\u003ch3\u003eSample Input 1\u003c/h3\u003e\n\u003cpre\u003e4\n1 3\n1 3\n3 6\n3 6\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 1\u003c/h3\u003e\n\u003cpre\u003e2 2\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Input 2\u003c/h3\u003e\n\u003cpre\u003e4\n1 2\n2 3\n1 3\n3 4\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 2\u003c/h3\u003e\n\u003cpre\u003e3 2\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Input 3\u003c/h3\u003e\n\u003cpre\u003e10\n84 302\n275 327\n364 538\n26 364\n29 386\n545 955\n715 965\n404 415\n903 942\n150 402\n\u003c/pre\u003e\n\n\u003ch3\u003eSample Output 3\u003c/h3\u003e\n\u003cpre\u003e6 5\n\u003c/pre\u003e"}}]}