{"raw_statement":[{"iden":"statement","content":"Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift — a large snow maker. He plans to make some amount of snow every day. On day _i_ he will make a pile of snow of volume _V__i_ and put it in her garden.\n\nEach day, every pile will shrink a little due to melting. More precisely, when the temperature on a given day is _T__i_, each pile will reduce its volume by _T__i_. If this would reduce the volume of a pile to or below zero, it disappears forever. All snow piles are independent of each other.\n\nNote that the pile made on day _i_ already loses part of its volume on the same day. In an extreme case, this may mean that there are no piles left at the end of a particular day.\n\nYou are given the initial pile sizes and the temperature on each day. Determine the total volume of snow melted on each day."},{"iden":"input","content":"The first line contains a single integer _N_ (1 ≤ _N_ ≤ 105) — the number of days.\n\nThe second line contains _N_ integers _V_1, _V_2, ..., _V__N_ (0 ≤ _V__i_ ≤ 109), where _V__i_ is the initial size of a snow pile made on the day _i_.\n\nThe third line contains _N_ integers _T_1, _T_2, ..., _T__N_ (0 ≤ _T__i_ ≤ 109), where _T__i_ is the temperature on the day _i_."},{"iden":"output","content":"Output a single line with _N_ integers, where the _i_\\-th integer represents the total volume of snow melted on day _i_."},{"iden":"examples","content":"Input\n\n3\n10 10 5\n5 7 2\n\nOutput\n\n5 12 4\n\nInput\n\n5\n30 25 20 15 10\n9 10 12 4 13\n\nOutput\n\n9 20 35 11 25"},{"iden":"note","content":"In the first sample, Bob first makes a snow pile of volume 10, which melts to the size of 5 on the same day. On the second day, he makes another pile of size 10. Since it is a bit warmer than the day before, the first pile disappears completely while the second pile shrinks to 3. At the end of the second day, he has only a single pile of size 3. On the third day he makes a smaller pile than usual, but as the temperature dropped too, both piles survive till the end of the day."}],"translated_statement":[{"iden":"statement","content":"Alice 非常喜欢雪！但不幸的是，今年的冬天已经结束，她再也无法等到更多的雪了。因此，Bob 给她买了一个礼物——一台大型造雪机。他计划每天制造一定量的雪。在第 #cf_span[i] 天，他会制造一个体积为 #cf_span[Vi] 的雪堆，并将其放在她的花园里。\n\n每天，每个雪堆都会因融化而略微缩小。更准确地说，当某天的温度为 #cf_span[Ti] 时，每个雪堆的体积会减少 #cf_span[Ti]。如果这会导致某个雪堆的体积减少到零或以下，则该雪堆将永久消失。所有雪堆彼此独立。\n\n请注意，第 #cf_span[i] 天制造的雪堆在当天就会开始融化。极端情况下，这意味着在某一天结束时可能没有任何雪堆剩余。\n\n给你每个雪堆的初始体积和每天的温度，请确定每天融化的雪的总体积。\n\n第一行包含一个整数 #cf_span[N] (#cf_span[1 ≤ N ≤ 105]) —— 天数。\n\n第二行包含 #cf_span[N] 个整数 #cf_span[V1, V2, ..., VN] (#cf_span[0 ≤ Vi ≤ 109])，其中 #cf_span[Vi] 表示第 #cf_span[i] 天制造的雪堆的初始体积。\n\n第三行包含 #cf_span[N] 个整数 #cf_span[T1, T2, ..., TN] (#cf_span[0 ≤ Ti ≤ 109])，其中 #cf_span[Ti] 表示第 #cf_span[i] 天的温度。\n\n请输出一行包含 #cf_span[N] 个整数，其中第 #cf_span[i] 个整数表示第 #cf_span[i] 天融化的雪的总体积。\n\n在第一个样例中，Bob 首先制造了一个体积为 10 的雪堆，当天融化后剩余体积为 5。第二天，他又制造了一个体积为 10 的雪堆。由于气温比前一天略高，第一个雪堆完全融化，而第二个雪堆缩小到 3。到第二天结束时，只剩下体积为 3 的一个雪堆。第三天，他制造了一个比平时小的雪堆，但气温也下降了，因此两个雪堆都存活到了当天结束。"},{"iden":"input","content":"第一行包含一个整数 #cf_span[N] (#cf_span[1 ≤ N ≤ 105]) —— 天数。第二行包含 #cf_span[N] 个整数 #cf_span[V1, V2, ..., VN] (#cf_span[0 ≤ Vi ≤ 109])，其中 #cf_span[Vi] 表示第 #cf_span[i] 天制造的雪堆的初始体积。第三行包含 #cf_span[N] 个整数 #cf_span[T1, T2, ..., TN] (#cf_span[0 ≤ Ti ≤ 109])，其中 #cf_span[Ti] 表示第 #cf_span[i] 天的温度。"},{"iden":"output","content":"请输出一行包含 #cf_span[N] 个整数，其中第 #cf_span[i] 个整数表示第 #cf_span[i] 天融化的雪的总体积。"},{"iden":"examples","content":"输入310 10 55 7 2输出5 12 4输入530 25 20 15 109 10 12 4 13输出9 20 35 11 25"},{"iden":"note","content":"在第一个样例中，Bob 首先制造了一个体积为 10 的雪堆，当天融化后剩余体积为 5。第二天，他又制造了一个体积为 10 的雪堆。由于气温比前一天略高，第一个雪堆完全融化，而第二个雪堆缩小到 3。到第二天结束时，只剩下体积为 3 的一个雪堆。第三天，他制造了一个比平时小的雪堆，但气温也下降了，因此两个雪堆都存活到了当天结束。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ N \\in \\mathbb{Z}^+ $ be the number of days.  \nFor each day $ i \\in \\{1, \\dots, N\\} $:  \n- $ V_i \\in \\mathbb{R}_{\\geq 0} $: initial volume of snow pile made on day $ i $.  \n- $ T_i \\in \\mathbb{R}_{\\geq 0} $: temperature on day $ i $.  \n\nLet $ S_i^{(d)} $ be the volume of the pile made on day $ i $ at the start of day $ d $, for $ d \\geq i $.  \nInitially, $ S_i^{(i)} = V_i $.  \n\n**Constraints**  \n1. $ 1 \\leq N \\leq 10^5 $  \n2. $ 0 \\leq V_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, N\\} $  \n3. $ 0 \\leq T_i \\leq 10^9 $ for all $ i \\in \\{1, \\dots, N\\} $  \n\n**Dynamics**  \nFor each pile $ i $ and each subsequent day $ d \\geq i $:  \n- If $ S_i^{(d)} > 0 $, then on day $ d $, it melts by $ \\min(S_i^{(d)}, T_d) $, and:  \n  $$\n  S_i^{(d+1)} = \\max(0, S_i^{(d)} - T_d)\n  $$  \n- If $ S_i^{(d)} = 0 $, then $ S_i^{(d+1)} = 0 $.  \n\n**Objective**  \nFor each day $ d \\in \\{1, \\dots, N\\} $, compute the total melted volume:  \n$$\nM_d = \\sum_{i=1}^{d} \\min(S_i^{(d)}, T_d)\n$$  \nwhere $ S_i^{(d)} = \\max\\left(0, V_i - \\sum_{j=i}^{d-1} T_j\\right) $ for $ d > i $, and $ S_i^{(i)} = V_i $.","simple_statement":null,"has_page_source":false}