#P3545. [POI 2012] HUR-Warehouse Store

[POI 2012] HUR-Warehouse Store

Description

There are nn days. On the morning of day ii, AiA_i items arrive. At noon of day ii, a customer wants to buy BiB_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 nn, the number of days.

The second line contains nn integers aia_i, where aia_i is the number of items arriving on the morning of day ii.

The third line contains nn integers bib_i, where bib_i is the number of items a customer wants to buy at noon of day ii.

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.

6
2 2 1 2 1 0
1 2 2 3 4 4
3
1 2 4

Hint

For 100%100\% of the testdata, 1n2.5×1051 \leqslant n \leqslant 2.5 \times 10^5, 0ai,bi1090 \leqslant a_i, b_i \leqslant 10^9.

Translated by ChatGPT 5