P3545 [POI 2012] HUR-Warehouse Store

Description

There are $n$ days. On the morning of day $i$, $A_i$ items arrive. At noon of day $i$, a customer wants to buy $B_i$ items; you may either fulfill the customer's request or ignore it. To fulfill the customer's request, you must have enough inventory. What is the maximum number of days whose customer requests can be fulfilled?

Input Format

The first line contains an integer $n$, the number of days. The second line contains $n$ integers $a_i$, where $a_i$ is the number of items arriving on the morning of day $i$. The third line contains $n$ integers $b_i$, where $b_i$ is the number of items a customer wants to buy at noon of day $i$.

Output Format

The first line contains a single integer: the maximum number of days whose customer requests can be fulfilled. The second line outputs one such set of days that achieves the maximum. If there are multiple solutions, output any one of them.

Explanation/Hint

For $100\%$ of the testdata, $1 \leqslant n \leqslant 2.5 \times 10^5$, $0 \leqslant a_i, b_i \leqslant 10^9$. Translated by ChatGPT 5