F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Philosophy Girl’s Trail

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 888    Accepted Submission(s): 292


Problem Description
  Philosophy Girl Krolia was always on the go. No one could figure out where she was. It’s said that she traveled all over the world with only two kinds of items:books and staffs.
  Krolia had a knapsack which is composed of n*m grids, and every item can be fit into grids. All the books’ size is 1*2(2*1), and the staffs’ is 1*3(3*1) and each of them can be rotated 90, 180 or 270 degrees. Every item is assigned a value and Krolia wanted to go with the maximal value.
 

Input
  The first line comes with one integer T (T=100) which denotes the test cases.
  In the first line of each case, there is four integers n (1<=n<=500), m (1<=m<=500), n1 (1<=n1<=10000) and n2 (1<=n2<=10000) which indicates the size of the knapsack, the number of the optional books and staffs.
  The next line contains n1 integers which indicate the value bi (0<=bi<=1000) of every book.
  The last line contains n2 integers si (0<=si<=1000) which indicate the value of every staff.
 

Output
  For each test case, output one line.
  First, output "Case #C: ", where C is the number of test case, from 1 to T. Then output the maximal value.
 

Sample Input
2 2 3 2 2 1 2 1 2 4 4 4 4 1 1 2 2 10 10 10 10
 

Sample Output
Case #1: 4 Case #2: 44
 

Hint

n,m,n1 and n2 <=100 in 20 cases.
50<=n,m<=500 and 1000<=n1,n2<=2000 in 50 cases.
100<=n,m<=200 and 9000<=n1,n2<=10000 in 30 cases.
 

Author
哲学少女系列@Krolia Fans Club
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 15:14:23, Gzip enabled