提示: 欢迎访问OurACM平台。
Problem 1974 Kill it in seconds

Accept: 171    Submit: 329
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

There are n knights and n monsters in city S, each knight has an ATK (attack value) and each monster has a HP (health point). If a knight’s ATK is no less than a monster’s HP, we say this knight can kill this monster in seconds.

Given every knight’s ATK and every monster’s HP. You should arrange the knights to kill the monsters and calculate the maximum number of monsters that can be killed in seconds. You should note that a monster can only be killed by a knight and a knight can only kill a monster.

Input

The first line of the input contains an integer T (T≤100), indicating the number of cases. Each case begins with a line containing an integer n (0<n≤1,000), the number of knights and monsters. The second line contains n integers Ai (1≤Ai≤1,000, 0<i≤n) separated by a blank space, the ATK of the knights. The third line contains n integers Hi (1≤Hi≤1,000, 0<i≤n) separated by a blank space, the HP of the monsters.

Output

For each test case, print a line containing the test case number (beginning with 1) and the maximum number of monsters that can be killed in seconds.

Sample Input

2 2 1 2 1 2 3 1 2 3 2 3 4

Sample Output

Case 1: 2 Case 2: 2

Source

The 35th ACM/ICPC Asia Regional Fuzhou Site —— Online Contest

Submit  Back  Status  Discuss