| Codeforces Round 1012 (Div. 1) |
|---|
| Finished |
This is the easy version of the problem. The difference between the versions is that in this version, $$$k=0$$$. You can hack only if you solved all versions of this problem.
Ecrade has two sequences $$$a_0, a_1, \ldots, a_{n - 1}$$$ and $$$b_0, b_1, \ldots, b_{n - 1}$$$ consisting of integers. It is guaranteed that the sum of all elements in $$$a$$$ does not exceed the sum of all elements in $$$b$$$.
Initially, Ecrade can make exactly $$$k$$$ changes to the sequence $$$a$$$. It is guaranteed that $$$k$$$ does not exceed the sum of $$$a$$$. In each change:
Then Ecrade will perform the following three operations sequentially on $$$a$$$ and $$$b$$$, which constitutes one round of operations:
Ecrade wants to know the minimum number of rounds required for all elements in $$$a$$$ to become equal to $$$0$$$ after exactly $$$k$$$ changes to $$$a$$$.
However, this seems a bit complicated, so please help him!
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 2\cdot 10^4$$$). The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$, $$$k$$$ ($$$1 \le n \le 2 \cdot 10^5$$$, $$$k = 0$$$).
The second line of each test case contains $$$n$$$ integers $$$a_0, a_1, \ldots, a_{n - 1}$$$ ($$$1 \le a_i \le 10^9$$$).
The third line of each test case contains $$$n$$$ integers $$$b_0, b_1, \ldots, b_{n - 1}$$$ ($$$1 \le b_i \le 10^9$$$).
It is guaranteed that the sum of $$$n$$$ across all test cases does not exceed $$$2\cdot 10^5$$$. It is also guaranteed that in each test case the sum of $$$a$$$ does not exceed the sum of $$$b$$$, and that $$$k$$$ does not exceed the sum of $$$a$$$.
For each test case, output the minimum number of rounds required for all elements in $$$a$$$ to become equal to $$$0$$$ after exactly $$$k$$$ changes to $$$a$$$.
43 01 1 45 1 44 01 2 3 44 3 2 14 02 1 1 21 2 2 18 01 2 3 4 5 6 7 88 7 6 5 4 3 2 1
1 4 4 8
In this version, Ecrade cannot make changes to $$$a$$$.
In the first test case:
In the second test case:
| Name |
|---|


