{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"Dima有一个由n个楼梯组成的楼梯。第一级在a1高度,第二级在a2高度,最后一级在an高度(1≤a1≤a2≤…≤an)。\n\n\n\n迪玛决定和楼梯一起玩,所以他从上往楼梯上扔长方形的盒子。第i个盒子的宽度为wi,高度为hi。Dima将每个盒子垂直向下扔到楼梯的第一个wi楼梯上,也就是说,盒子覆盖了编号为1、2、…、wi的楼梯。每个投掷箱垂直向下飞行,直到至少发生以下两种情况之一:\n\n\n\n盒子的底部与楼梯的顶部相接;\n\n盒子的底部与之前抛出的盒子的顶部相接触。\n\n我们只考虑楼梯和箱子的水平边的接触,不考虑角落的接触。具体来说,这意味着一个宽度为wi的盒子不能接触到编号为wi + 1的楼梯。\n\n\n\n你会看到楼梯的描述和Dima扔箱子的顺序。对于每个箱子,确定落地后箱子底部的高度。假设一个箱子在前一个箱子落地后落下。"}},{"title":"Input","value":{"format":"HTML","content":"第一行包含整数n(1≤n≤10^5)——楼梯的楼梯数。第二行包含一个非递减序列,由n个整数组成,a1, a2,…, an(1≤ai≤10^9;ai≤ai + 1)。\n\n\n\n下一行包含整数m(1≤m≤10^5)——盒子的数量。以下每m行包含一对整数wi, hi(1≤wi≤n;1≤hi≤10^9)-第i个投箱的大小。\n\n\n\n行中的数字用空格隔开。"}},{"title":"Output","value":{"format":"HTML","content":"打印m个整数-每个箱子的高度,箱子的底部将在着陆后。按输入框中给出的方框的顺序打印答案。\n\n\n请不要使用%lld说明符在c++中读取或写入64位整数。建议使用cin、cout流或%I64d指定符。\n题目你肯定看不懂,看样例和tips吧!!!"}},{"title":"Examples","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e5\u003cbr\u003e1 2 3 6 6\u003cbr\u003e4\u003cbr\u003e1 1\u003cbr\u003e3 1\u003cbr\u003e1 1\u003cbr\u003e4 3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e1\u003cbr\u003e3\u003cbr\u003e4\u003cbr\u003e6\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e3\u003cbr\u003e1 2 3\u003cbr\u003e2\u003cbr\u003e1 1\u003cbr\u003e3 1\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e1\u003cbr\u003e3\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e1\u003cbr\u003e1\u003cbr\u003e5\u003cbr\u003e1 2\u003cbr\u003e1 10\u003cbr\u003e1 10\u003cbr\u003e1 10\u003cbr\u003e1 10\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003e1\u003cbr\u003e3\u003cbr\u003e13\u003cbr\u003e23\u003cbr\u003e33\u003cbr\u003e\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eThe first sample are shown on the picture.\u003c/p\u003e\n\u003ccenter\u003e \n \u003cimg class\u003d\"tex-graphics\" SRC\u003d\"CDN_BASE_URL/018c581a6e876f86e530262d65c3b46e?v\u003d1584513304\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \n\u003c/center\u003e"}}]}