Untitled conversation
- User
[04/10, 9:58 pm] Ámir: HISTORY
RULES
You are a book collector aiming to sell your collection of A books. The books are arranged in a line with the ith book to the left of the (i+1)th book for 1A-1. The thickness of each book is represented by an array B (B[i] representing the thickness of the ith book) and each book has a unique thickness.
README
SETTINGS
To enhance the appeal of your books, you can apply a special protective cover to some of them. However, this cover is expensive, so you want to minimize its use while ensuring the following conditions are met
-
You should apply the protective cover to at least one book.
-
If you apply the cover to the ith book, then you must also apply it to each book that is thicker than the ith book.
-
There must exist at least one subarray (contiguous segment) of books of size at least C, such that the number of books with the protective cover is greater than the number of books without the cover
TESTS
CUSTOM TESTS
MORE [04/10, 9:59 pm] Ámir: QUESTIONS
DESC
you must also apply it to each book that is thicker than the ith book.
<<<
main.cpp
1 int solution(int a
}
HISTORY
- There must exist at least one subarray (contiguous segment) of books of size at least C, such that the number of books with the protective cover is greater than the number of books without the cover
RULES
README
Your task is to dritermine the smallest number of books on which you should apply the protective cover to satisfy the above conditions.
DOL
Problem Constraints:
SETTINGS
1A 10°5 1 BA. (1 i<j<=n. B[i] #B)) 1CA
Input Format:
First argument A is the number of books. Second, argument 8 is an array representing the thickness of the books.
• Third argument C in the minimum length of the subarray according to the condition defined in the problem statement.
Output Format:
-
- Assistant