{"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\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:40.00%\" class\u003d\"illustration\"\u003e\n \u003cimg src\u003d\"CDN_BASE_URL/e2ec69cd08b3e33b4423d7bf7edee967?v\u003d1718553202\" alt\u003d\"/problems/janeeyre/file/statement/en/img-0001.jpg\" class\u003d\"illustration\"\u003e\n \n \u003c/div\u003e\n \u003cp\u003eAnna wants to read the famous book \u003cem\u003eJane Eyre\u003c/em\u003e, but\n annoyingly its title is somewhat late in the alphabet. This is\n a problem, since Anna always reads books in alphabetical order;\n as soon as she finish reading a book, she immediately begins\n reading the next book in her possession which comes first\n according to ASCII-order.\u003c/p\u003e\n \u003cp\u003eTo make matters even worse, Anna often receives new books as\n presents. Such books go into the pile of Anna’s unread books\n (she will finish the book she is currently reading even if the\n received book is earlier in the alphabet). If she receives one\n or more books at the exact same moment as she finishes another\n book, though, then she will pick her next book among both the\n books in her existing pile and the newly received books.\u003c/p\u003e\n \u003cp\u003eGiven Anna’s pile of unread books and a schedule for at\n which points in time Anna’s friends will give her new books,\n can you figure out when she will finish reading \u003cem\u003eJane\n Eyre\u003c/em\u003e? Anna reads at a speed of one page per minute.\u003c/p\u003e\n \u003ch2\u003eInput\u003c/h2\u003e\n \u003cp\u003eOn the first line are three non-negative integers\n \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e, \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e, and \u003cspan class\u003d\"tex2jax_process\"\u003e$k$\u003c/span\u003e; here \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$0\n \\leq n \u0026lt; 100\\, 000$\u003c/span\u003e) indicates the number of unread\n books in Anna’s pile (in addition to \u003cem\u003eJane Eyre\u003c/em\u003e),\n \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$0 \\leq m \u0026lt; 100\\, 000$\u003c/span\u003e) indicates\n the number of books her friends will give her, and \u003cspan class\u003d\"tex2jax_process\"\u003e$k$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1\n \\leq k \u0026lt; 100\\, 000$\u003c/span\u003e) indicates the number of pages in\n \u003cem\u003eJane Eyre\u003c/em\u003e.\u003c/p\u003e\n \u003cp\u003eThe next \u003cspan class\u003d\"tex2jax_process\"\u003e$n$\u003c/span\u003e lines\n describe the other unread books in Anna’s pile; the\n \u003cspan class\u003d\"tex2jax_process\"\u003e$i^{\\text {th}}$\u003c/span\u003e such line\n contains a string \u003cspan class\u003d\"tex2jax_process\"\u003e$s_ i$\u003c/span\u003e\n (\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq |s_ i| \\leq 20$\u003c/span\u003e)\n and a positive integer \u003cspan class\u003d\"tex2jax_process\"\u003e$k_\n i$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq k_ i \u0026lt;\n 100\\, 000$\u003c/span\u003e) indicating respectively the title of the\n book and how many pages it contains. The string \u003cspan class\u003d\"tex2jax_process\"\u003e$s_ i$\u003c/span\u003e will be enclosed in double\n quotes (\u003ctt class\u003d\"ttfamily\"\u003e\"\u003c/tt\u003e), and consists of a mixture\n of spaces and alphanumeric ASCII characters.\u003c/p\u003e\n \u003cp\u003eFinally follows \u003cspan class\u003d\"tex2jax_process\"\u003e$m$\u003c/span\u003e\n lines describing the books Anna’s friends will give her; the\n \u003cspan class\u003d\"tex2jax_process\"\u003e$j^{\\text {th}}$\u003c/span\u003e such line\n contains a non-negative integer \u003cspan class\u003d\"tex2jax_process\"\u003e$t_ j$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$0 \\leq t_ j \\leq 1\\, 000\\, 000\\,\n 000$\u003c/span\u003e), a string \u003cspan class\u003d\"tex2jax_process\"\u003e$s_\n j$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq |s_ j| \\leq\n 20$\u003c/span\u003e) and a positive integer \u003cspan class\u003d\"tex2jax_process\"\u003e$k_ j$\u003c/span\u003e (\u003cspan class\u003d\"tex2jax_process\"\u003e$1 \\leq k_ j \u0026lt; 100\\, 000$\u003c/span\u003e)\n indicating respectively the time (in minutes from now) Anna\n will receive the book, the title of the book and how many pages\n it contains. The string \u003cspan class\u003d\"tex2jax_process\"\u003e$s_\n j$\u003c/span\u003e will be enclosed in double quotes (\u003ctt class\u003d\"ttfamily\"\u003e\"\u003c/tt\u003e), and consists of a mixture of spaces and\n alphanumeric ASCII characters.\u003c/p\u003e\n \u003ch2\u003eOutput\u003c/h2\u003e\n \u003cp\u003eA single integer, the minute at which Anna finish reading\n \u003cem\u003eJane Eyre\u003c/em\u003e.\u003c/p\u003e\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\u003e2 2 592\n\"Pride and Predjudice\" 432\n\"Don Quixote\" 863\n863 \"Great Gatsby\" 218\n1082 \"Crime and Punishment\" 545\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1673\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/body\u003e\n "}}]}