Problem A
Kill it in seconds Time Limit: 1 second Memory Limit: 32 megabytes 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
Output for the Sample Input
2 2 1 2 1 2 3 1 2 3 2 3 4
Case 1: 2 Case 2: 2
Problem B
Three kingdoms Time Limit: 1 second Memory Limit: 32 megabytes Romance of The Three Kingdoms is one of the great Chinese classics and is compiled into a semi-fictional literary masterpiece during the Ming Dynasty by Luo Guanzhong. The novel comprises around 70+% fact and 20+% fiction. Some issues such as Guan Yu's weapon weighing around 40+ kilograms, the capability of Lu Bu, Liu Bei's horses as well as the existence of the Valley of the Fallen Phoenix and some others are probably fictional. That period in history can be said as the golden age of chivalry and although it happened more than 1700 years ago, characters such as Liu Bei, Guan Yu, Zhang Fei, Zhuge Liang and Cao Cao have become household names among Chinese. There are many movies and games' background based on the story. Many wars occur between different armies. Bob is one of the Three Kingdoms fans. One light, he dreams he was Cao Cao. But it is not a sweet dream. A strong Army invades his country. The number of soldiers in the army is N (0<N≤10,000). Bob is so worried that he convenes all his M (0<M≤10,000) crossbowmen on the wall. Each crossbowman has only one arrow. Bob orders them to shoot in the same direction V (vx, vy, vz). So many enemy soldiers are shot by arrows and die. Then he opens the gate to make a big fight with the left enemy soldiers. Finally he achieves victory. Bob wants to know the number of enemy soldiers who are shot by his crossbowmen. The arrow is so sharp that it can still fly in the same direction after shooting somebody. There may be more than one people in the same position. If many enemy soldiers stand in the same position, they may be shot at a time. If an enemy soldier and a crossbowman stand in the same position, the enemy soldier will also be shot. Input The first line of the input contains an integer T (T≤10), indicating the number of cases. Each case begins with a line containing two integers N and M (0<N, M≤10,000). Each of the following N lines contains three integers xi, yi and zi (|xi|, |yi|, |zi|≤100,000, 1≤i≤N), the coordinate of the i-th soldier is (xi, yi, zi). Each of the following M lines contains three integers xi, yi and zi (|xi|, |yi|, |zi|≤100,000, 1≤i≤M), the coordinate of the i-th crossbowman is (xi, yi, zi). The next line contains three integers vx, vy and vz (0<|vx|+|vy|+|vz|≤300,000), the direction in which all the crossbowmen shot their arrows. Output For each test case, print a line containing the test case number (beginning with 1) and the number of enemy soldiers who are shot by Bob’s crossbowmen. Sample Input Output for the Sample Input
2
1 1
1 1 1
0 0 0
1 1 1
2 1
2 1 1
4 2 2
0 0 0
2 1 1
Case 1: 1
Case 2: 2