6
\$\begingroup\$

why did they put this challenge on hold?

How could I have made it clearer?

Benjamin has N boxes in his garden with dimension xiyizi each. Because he does not want to let them out and get wet, he wants to put them in the warehouse with a capacity of V. To solve this problem, Benjamin bought a machine which, with the cost of 1 buck, gets a box and increases or decreases all its dimensions by one unit. The box will not change at all if the box change leads to some of its dimensions are zero or negative.

Your task is to help Benjamin put the boxes in his warehouse with the least possible cost, making the total box volume equal to V.

Input Format

The first entry line will contain the integers N and V, the total number of Benjamin's boxes and the volume of the warehouse. The following N lines contain 3 integers xi, yi, zi, the original dimensions of the ith box.

Output data

The only line of output must contain the minimum cost which Benjamin will have to pay the machine, to convert the volume of his boxes to exactly V, or return -1, if this is not possible.

Sample Input 1

4 9

1 1 2

1 1 2

1 1 1

2 2 1

Sample Output 1

0

Sample Input 2

3 123

10 1 10

2 5 6

5 3 3

Sample Output 2

3

Explanation

observe that in the first sample input the volume of the boxes is already 2+2+1+4=9, so Benjamin does not have to change the boxes at all.

Moreover, observe that in the first box, the second boxes dimensions need to be reduced by 1 unit and the dimensions of the third box need to be reduced by 2 units. So the total volume will be 100+20+3=123.

| |
\$\endgroup\$
  • \$\begingroup\$ (note: the two * are interpreted as markdown format. Escape them.) \$\endgroup\$ – user202729 May 22 '19 at 3:28
16
\$\begingroup\$

At a brief glance, some potential reasons are:

  • This looks a lot like a homework question or a coding challenge taking from another site.
    • We don't help with homework
    • Using a challenge from another site requires explicit permission
  • The challenge has a fixed clunky I/O format specified
    • This community heavily favors flexible I/O
  • When the winning condition is fastest-code you should specify how you will run it and on what specs, so that solutions can be optimized
  • This community also dislikes language specific challenges, so unless there is a reason why it must be in c++, consider opening it up for all languages to participate

We have a sandbox where you can post challenge ideas and get help from the community, making it better suited to this site. Don't let this setback discourage you from posting challenges in the future. Leave them in the sandbox for a few days or more depending on how active people are and what help you have received and I'm sure you can get some nice questions going.

| |
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .