Welcome to the Luggage Optimizer, a project developed as part of the Algorithms course at the University of Michigan-Dearborn. Help Eiffel Baguette, an exchange student, maximize the value of items he can pack in his luggage while adhering to flight regulations.
Eiffel Baguette, the top student from ESIEA studying at UMich, has a peculiar habit of packing his luggage at the last minute. With flight regulations allowing only one luggage, Eiffel needs to decide which items and souvenirs to pack to maximize their value to him.
Using his computer science skills, Eiffel labels each item with two values: its volume and its value to him. Your task is to help Eiffel determine the optimal set of items to pack.
- Input Data: Place your input data in the
input.txt
file located at the project root. - Run the Program: Execute the
App.java
file located in thesrc
directory. - View the Output: The program will display the maximum value of items Eiffel can pack, along with the names of the selected items.
- The first line specifies the number of test cases,
C
. - Each test case starts with the number of items,
N
, and the luggage capacity,W
. - This is followed by
N
lines, each detailing the name, volume, and value of an item.
For each test case, the program outputs:
- The maximum value of the sum of the item values.
- The count of items selected.
- The names of the selected items.
Input:
2
6 10
laptop 4 7
camera 2 10
xbox 6 6
grinder 4 7
dumbell 2 5
dictionary 10 4
6 17
laptop 4 7
camera 2 10
xbox 6 6
grinder 4 7
dumbell 2 5
dictionary 10 4
Output:
24 3
laptop
camera
grinder
30 4
laptop
camera
xbox
grinder
- Memory limit: 64 MB.
- Time limit: 2 seconds (2000 ms).
- 1 ≤
C
≤ 50 - 1 ≤
N
≤ 100 - 1 ≤
W
≤ 1000