#P17546. [JAG 2026 Summer Camp #2] Vibe Coding
[JAG 2026 Summer Camp #2] Vibe Coding
Problem Description
Shobon has decided to use a generative AI to help develop a software project. The project consists of tasks. Each task () has a predetermined implementation workload and complexity .
Shobon can proceed with these tasks in any order. However, he cannot work on more than one task at the same time.
Each task () can be completed in one of the following two ways:
- Implement the task manually. Shobon writes the code himself, which takes units of time.
- Use the generative AI. To make the AI generate correct code, Shobon explains the current task and all previously completed tasks to the AI. Let be the sum of the complexities of all previously completed tasks. Preparing this explanation takes units of time. The AI then finishes the implementation instantly, so no additional implementation time is required. Thus, completing this task by using the AI takes a total of units of time.
Regardless of which method is used, once task is completed, its complexity is included in future values of when using the generative AI.
Find the minimum total time required to complete all tasks.
Input Format
The input consists of three lines in the following format.
N
A_1 A_2 ... A_N
B_1 B_2 ... B_N
In the first line, the number of tasks, , is given (). The second line contains integers, , each between and , inclusive, representing the implementation workloads of the tasks. The third line contains integers, , each between and , inclusive, representing the complexities of the tasks.
Output Format
Output in a line the minimum total time required to complete all tasks.
3
10 6 10
5 2 4
18
1
4
10
4
5
100 100 100 100 100
5 1 4 2 3
35
12
18 7 25 12 30 5 16 22 9 28 14 20
6 11 2 8 1 13 5 3 10 4 9 7
118
Hint
For Sample Input 1, consider using the generative AI for tasks and in this order, and then implementing task manually.
- When task is started, no task has been completed yet. This task takes units of time.
- When task is started, task has been completed. This task takes units of time.
- Finally, implementing task manually takes units of time.
Thus, all tasks can be completed in units of time, which is the minimum possible.