E. ¡¡Telo, en ti erro!!
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

For many years, the kingdoms of Karsmir, ruled by King Telo, and Elyria, ruled by Queen Sofia, lived in perfect harmony. Their alliance was not only political; it was also the reflection of a deep love that had united their hearts since youth.

They shared victories, developed magical defense technology, and dreamed of building a peaceful world. However, this union ended suddenly when Sofia discovered that Telo had been secretly communicating with an old love from the northern lands. Telo claimed it was just a diplomatic exchange, but Sofia, feeling betrayed, decided to break the relationship—and the alliance. Now, both kingdoms are at war, and the situation is bleak.

In the kingdom of Karsmir, there are $$$n$$$ underground bunkers placed in a row, numbered from $$$1$$$ to $$$n$$$, from left to right. Each bunker has a depth $$$d_i$$$ and an energy cost $$$e_i$$$.

Because of the air attacks ordered by Sofia, it is necessary to select the largest possible subset of bunkers that can be connected using magical communication without interference. To make this work, the following condition must be satisfied:

  • Close Energy Optimization

    A bunker $$$i$$$ can only be selected if the first bunker to its right with a lower depth ($$$d_j$$$ < $$$d_i$$$) also has a lower energy cost ($$$e_j$$$ < $$$e_i$$$).

    Formally, let $$$j$$$ be the smallest index such that $$$j \gt i$$$ and $$$d_j \lt d_i$$$ . Then, bunker $$$i$$$ can be selected only if $$$e_i \gt e_j$$$.

    If there is no bunker to the right of $$$i$$$ with lower depth, then $$$i$$$ can be selected freely.

    (Bunkers closer to the surface interfere with the signal if they consume more energy than the deeper bunker trying to communicate)

Your task is to print the longest possible subsequence of bunkers that can be created following this condition.

Input

The first line contains an integer $$$n$$$ $$$(3 \leq n \leq 10^6)$$$ — the number of bunkers in Telo's kingdom.

The second line contains $$$n$$$ space-separated integers $$$d_1, d_2, \dots, d_n$$$ $$$(100 \leq d_i \leq 10^9)$$$ — representing the depth of each bunker. All depths are distinct.

The third line contains $$$n$$$ space-separated integers $$$e_1, e_2, \dots, e_n$$$ $$$(1 \leq e_i \leq 10^9)$$$ — representing the energy cost of each bunker.

Output

Output an integer $$$k$$$ $$$(1 \leq k \leq n)$$$ — the size of the longest subsequence of bunkers that can be selected following the above conditions.

Then, on the next line, output $$$k$$$ integers $$$a_1, a_2, \dots, a_k$$$ $$$(1 \leq a_i \lt a_{i+1} \leq n)$$$ — the indices of the bunkers that belong to the longest valid subsequence.

Example
Input
6
120 110 130 111 105 140
15 8 30 10 30 2
Output
4
1 3 5 6