LIS

0

0 votes
Hard
Problem

You are given an array A consisting of n elements, and m integers. You have to find the length of largest possible strictly increasing sub-sequence of array A after inserting m integers. You can insert m integers at any place and any number of times.

Input:

First line contains integer n. Second line contains n integers. Third line contains integer m. Fourth line contains m integers.

Output:

Output single line containing the answer.

Constraints:

  • 1 <= n <= 1000000
  • 1 <= m <= 8
  • 1 <= elements of A and B <= 1000000

Setter: Mohib Manva

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?