{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n div.illustration {\n float: right;\n padding-left: 20px;\n }\n div.illustration .illustration {\n width: 100%;\n border-radius: 4px;\n }\n pre {\n display: block;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n color: #333;\n word-break: break-all;\n word-wrap: break-word;\n }\n div.sampleinteractionread {\n width: 60%;\n margin: 3px 0px 3px 0px;\n }\n div.sampleinteractionread pre {\n margin: 1px 5px 1px 5px;\n border-radius: 5px;\n border: solid 1px rgba(255, 255, 255, 0.25);\n background-color: #cccccc;\n padding: 14px 13px;\n font-family: Courier, monospace;\n font-variant-ligatures: none;\n }\n div.sampleinteractionwrite {\n width: 60%;\n margin: 3px 0px 3px 0px;\n margin-left: auto;\n }\n div.sampleinteractionwrite pre {\n margin: 1px 5px 1px 5px;\n border-radius: 5px;\n border: solid 1px rgba(255, 255, 255, 0.25);\n background-color: #cccccc;\n padding: 14px 13px;\n font-family: Courier, monospace;\n font-variant-ligatures: none;\n }\n table.sample {\n width: 100%;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv style\u003d\"width:50.00%\" class\u003d\"illustration\"\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/aa884dc399dba83aaab1662324a3ff48?v\u003d1726806849\" alt\u003d\"/problems/gcpc/file/statement/en/img-0001.jpg\" class\u003d\"illustration\"\u003e\n\n \n \u003c/div\u003eOne hundred years from now, in \u003cspan class\u003d\"tex2jax_process\"\u003e$2117$\u003c/span\u003e, the International Collegiate\n Programming Contest (of which the NCPC is a part) has expanded\n significantly and it is now the Galactic Collegiate Programming\n Contest (GCPC).\n\n \u003cp\u003eThis year there are \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e\n teams in the contest. The teams are numbered \u003cspan class\u003d\"tex2jax_process\"\u003e$1,2,\\ldots ,n$\u003c/span\u003e, and your favorite\n team has number \u003cspan class\u003d\"tex2jax_process\"\u003e$1$\u003c/span\u003e.\u003c/p\u003e\n\n \u003cp\u003eLike today, the score of a team is a pair of integers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$(a,b)$\u003c/span\u003e where \u003cspan class\u003d\"tex2jax_process\"\u003e$a$\u003c/span\u003e is the number of solved problems\n and \u003cspan class\u003d\"tex2jax_process\"\u003e$b$\u003c/span\u003e is the total\n penalty of that team. When a team solves a problem there is\n some associated penalty (not necessarily calculated in the same\n way as in the NCPC – the precise details are not important in\n this problem). The total penalty of a team is the sum of the\n penalties for the solved problems of the team.\u003c/p\u003e\n\n \u003cp\u003eConsider two teams \u003cspan class\u003d\"tex2jax_process\"\u003e$t_1$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$t_2$\u003c/span\u003e whose scores are \u003cspan class\u003d\"tex2jax_process\"\u003e$(a_1,b_1)$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$(a_2,b_2)$\u003c/span\u003e. The score of team\n \u003cspan class\u003d\"tex2jax_process\"\u003e$t_1$\u003c/span\u003e is better than that\n of \u003cspan class\u003d\"tex2jax_process\"\u003e$t_2$\u003c/span\u003e if either\n \u003cspan class\u003d\"tex2jax_process\"\u003e$a_1\u0026gt;a_2$\u003c/span\u003e, or if\n \u003cspan class\u003d\"tex2jax_process\"\u003e$a_1\u003da_2$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$b_1\u0026lt;b_2$\u003c/span\u003e. The rank of a team is\n \u003cspan class\u003d\"tex2jax_process\"\u003e$k+1$\u003c/span\u003e where \u003cspan class\u003d\"tex2jax_process\"\u003e$k$\u003c/span\u003e is the number of teams whose score\n is better.\u003c/p\u003e\n\n \u003cp\u003eYou would like to follow the performance of your favorite\n team. Unfortunately, the organizers of GCPC do not provide a\n scoreboard. Instead, they send a message immediately whenever a\n team solves a problem.\u003c/p\u003e\n\n \u003ch2\u003eInput\u003c/h2\u003e\n\n \u003cp\u003eThe first line of input contains two integers \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e, where \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le n \\le 10^5$\u003c/span\u003e is the number of\n teams, and \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le m \\le\n 10^5$\u003c/span\u003e is the number of events.\u003c/p\u003e\n\n \u003cp\u003eThen follow \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e lines\n that describe the events. Each line contains two integers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$t$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$p$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\le t \\le n$\u003c/span\u003e and \u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\le p\n \\le 1000$\u003c/span\u003e), meaning that team \u003cspan class\u003d\"tex2jax_process\"\u003e$t$\u003c/span\u003e has solved a problem with penalty\n \u003cspan class\u003d\"tex2jax_process\"\u003e$p$\u003c/span\u003e. The events are\n ordered by the time when they happen.\u003c/p\u003e\n\n \u003ch2\u003eOutput\u003c/h2\u003e\n\n \u003cp\u003eOutput \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e lines. On\n the \u003cspan class\u003d\"tex2jax_process\"\u003e$i$\u003c/span\u003e’th line, output\n the rank of your favorite team after the first \u003cspan class\u003d\"tex2jax_process\"\u003e$i$\u003c/span\u003e events have happened.\u003c/p\u003e\n\n \u003ch2\u003eSample 1\u003c/h2\u003e\u003cbody\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 4\n2 7\n3 5\n1 6\n1 9\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n3\n2\n1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}