Kabaleo Lite
题号:NC210256
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Tired of boring WFH (work from home), Apollo decided to open a fast food restaurant, called .
The restaurant serves n kinds of food, numbered from 1 to n. The profit for the i-th kind of food is a_i. Profit may be negative because it uses expensive ingredients. On the first day, Apollo prepared b_i dishes of the i-th kind of food.
The peculiarity of Apollo's restaurant is the procedure of ordering food. For each visitor Apollo himself chooses a set of dishes that this visitor will receive. When doing so, Apollo is guided by the following rules:
  • every visitor should receive at least one dish.
  • each visitor should receive continuous kinds of food started from the first food. And the visitor will receive exactly 1 dish for each kind of food. For example, a visitor may receive 1 dish of the 1st kind of food, 1 dish of the 2nd kind of food, 1 dish of the 3rd kind of food.
What's the maximum number of visitors Apollo can feed? And he wants to know the maximum possible profits he can earn to have the maximum of visitors.

输入描述:

The first line of the input gives the number of test case,  ().  test cases follow.
Each test case begins with a line containing one integers n (), representing the number of different kinds of food.
The second line contains n space-separated numbers a_i (), where a_i denotes the profit of one dish of the i-th kind.
The third line contains n space-separated numbers b_i (), where b_i denotes the number of the i-th kind of dishes.

输出描述:

For each test case, output one line containing , where x is the test case number (starting from 1), y is the maximum number of visitors, and z is the maximum possible profits.
示例1

输入

复制
2
3
2 -1 3
3 2 1
4
3 -2 3 -1
4 2 1 2

输出

复制
Case #1: 3 8
Case #2: 4 13

说明

For test case 1, the maximum number of visitors is 3, one of a possible solution is:
The first visitor received food 1, the profit is 2.
The second visitor received food 1, the profit is 2.
The third visitor received food 1 + food 2 + food 3, the profit is 2 + (-1) + 3.