{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\n\tYou have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape \u003ci\u003eN\u003c/i\u003e minutes long. How to choose tracks from CD to get most out of tape space and have as short unused space as possible.\u003c/p\u003e\n\u003cp\u003e\n\tAssumptions:\u003c/p\u003e\n\u003cul\u003e\n\t\u003cli\u003e\n\t\tnumber of tracks on the CD. does not exceed 20\u003c/li\u003e\n\t\u003cli\u003e\n\t\tno track is longer than \u003ci\u003eN\u003c/i\u003e minutes\u003c/li\u003e\n\t\u003cli\u003e\n\t\ttracks do not repeat\u003c/li\u003e\n\t\u003cli\u003e\n\t\tlength of each track is expressed as an integer number\u003c/li\u003e\n\t\u003cli\u003e\n\t\t\u003ci\u003eN\u003c/i\u003e is also integer\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\n\tProgram should find the set of tracks which fills the tape best and print it in the same sequence as the tracks are stored on the CD\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e\n\tAny number of lines. Each one contains value \u003ci\u003eN\u003c/i\u003e, (after space) number of tracks \u003ci\u003eM\u003c/i\u003e and durations of the tracks. For example from first line in sample data: \u003ci\u003eN\u003c/i\u003e\u003d5, \u003ci\u003eM\u003c/i\u003e\u003d3, first track lasts for 1 minute, second one 3 minutes, next one 4 minutes\u003c/p\u003e\n\u003cp\u003eThe input data satisfies the following constraints:\u003c/p\u003e\n\u003cp\u003eN≤10000\n\u003cbr\u003eM≤20\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e\n\tSet of tracks (and durations) which are the correct solutions and string ``\u003ctt\u003esum:\u003c/tt\u003e\u0026quot; and sum of duration times.\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e\n5 3 1 3 4\n10 4 9 8 4 2\n20 4 10 5 7 4\n90 8 10 23 1 2 3 4 5 7\n45 8 4 10 44 43 12 9 8 2\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003e\n1 4 sum:5\n8 2 sum:10\n10 5 4 sum:19\n10 23 1 2 3 4 5 7 sum:55\n4 10 12 9 8 2 sum:45\u003c/pre\u003e"}}]}