CF1690C.Restoring the Duration of Tasks

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The first line contains a single integer tt ( 1t1041 \le t \le 10^4 ) — the number of test cases.

The descriptions of the input data sets follow.

The first line of each test case contains one integer nn ( 1n21051 \le n \le 2 \cdot 10^5 ).

The second line of each test case contains exactly nn integers s1<s2<<sns_1 < s_2 < \dots < s_n ( 0si1090 \le s_i \le 10^9 ).

The third line of each test case contains exactly nn integers f1<f2<<fnf_1 < f_2 < \dots < f_n ( si<fi109s_i < f_i \le 10^9 ).

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^5 .

输入格式

For each of tt test cases print nn positive integers d1,d2,,dnd_1, d_2, \dots, d_n — the duration of each task.

输出格式

First test case:

The queue is empty at the beginning: [][ ] . And that's where the first task comes in. At time 22 , Polycarp finishes doing the first task, so the duration of the first task is 22 . The queue is empty so Polycarp is just waiting.

At time 33 , the second task arrives. And at time 77 , the third task arrives, and now the queue looks like this: [7][7] .

At the time 1010 , Polycarp finishes doing the second task, as a result, the duration of the second task is 77 .

And at time 1010 , Polycarp immediately starts doing the third task and finishes at time 1111 . As a result, the duration of the third task is 11 .

An example of the first test case.

输入输出样例

  • 输入#1

    4
    3
    0 3 7
    2 10 11
    2
    10 15
    11 16
    9
    12 16 90 195 1456 1569 3001 5237 19275
    13 199 200 260 9100 10000 10914 91066 5735533
    1
    0
    1000000000

    输出#1

    2 7 1 
    1 1 
    1 183 1 60 7644 900 914 80152 5644467 
    1000000000

说明/提示

First test case:

The queue is empty at the beginning: [][ ] . And that's where the first task comes in. At time 22 , Polycarp finishes doing the first task, so the duration of the first task is 22 . The queue is empty so Polycarp is just waiting.

At time 33 , the second task arrives. And at time 77 , the third task arrives, and now the queue looks like this: [7][7] .

At the time 1010 , Polycarp finishes doing the second task, as a result, the duration of the second task is 77 .

And at time 1010 , Polycarp immediately starts doing the third task and finishes at time 1111 . As a result, the duration of the third task is 11 .

An example of the first test case.

首页