{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e \u003ca href\u003d\"http://uva.onlinejudge.org/external/1/102.pdf\"\u003e\u003cimg alt\u003d\"Download as PDF\" height\u003d\"26\" src\u003d\"http://uva.onlinejudge.org/components/com_onlinejudge/images/button_pdf.png\" title\u003d\"Download as PDF\" width\u003d\"100\" /\u003e\u003c/a\u003e\u003c/p\u003e \n\u003cdiv\u003e\n \u0026nbsp;\n\u003c/div\u003e \n\u003cp\u003e count it\u003c/p\u003e \n\u003ch1\u003e \u0026nbsp;\u003c/h1\u003e \n\u003cbr /\u003e \n\u003ctable\u003e \n \u003ctbody\u003e \n \u003ctr\u003e \n \u003ctd\u003e \u003ch1\u003e \u003cb\u003e\u0026nbsp;count it\u003c/b\u003e\u003c/h1\u003e \u003c/td\u003e \n \u003c/tr\u003e \n \u003c/tbody\u003e \n\u003c/table\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003eBackground\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e Bin packing, or the placement of objects of certain weights into different bins subject to certain constraints, is an historically interesting problem. Some bin packing problems are NP-complete but are amenable to dynamic programming solutions or to approximately optimal heuristic solutions.\u003c/p\u003e \n\u003cp\u003e In this problem you will be solving a bin packing problem that deals with recycling glass.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003eThe Problem\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e Recycling glass requires that the glass be separated by color into one of three categories: brown glass, green glass, and clear glass. In this problem you will be given three recycling bins, each containing a specified number of brown, green and clear bottles. In order to be recycled, the bottles will need to be moved so that each bin contains bottles of only one color.\u003c/p\u003e \n\u003cp\u003e The problem is to minimize the number of bottles that are moved. You may assume that the only problem is to minimize the number of movements between boxes.\u003c/p\u003e \n\u003cp\u003e For the purposes of this problem, each bin has infinite capacity and the only constraint is moving the bottles so that each bin contains bottles of a single color. The total number of bottles will never exceed 2^31.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003eThe Input\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e The input consists of a series of lines with each line containing 9 integers. The first three integers on a line represent the number of brown, green, and clear bottles (respectively) in bin number 1, the second three represent the number of brown, green and clear bottles (respectively) in bin number 2, and the last three integers represent the number of brown, green, and clear bottles (respectively) in bin number 3. For example, the line 10 15 20 30 12 8 15 8 31\u003c/p\u003e \n\u003cp\u003e indicates that there are 20 clear bottles in bin 1, 12 green bottles in bin 2, and 15 brown bottles in bin 3.\u003c/p\u003e \n\u003cp\u003e Integers on a line will be separated by one or more spaces. Your program should process all lines in the input file.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003eThe Output\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e For each line of input there will be one line of output indicating what color bottles go in what bin to minimize the number of bottle movements. You should also print the minimum number of bottle movements.\u003c/p\u003e \n\u003cp\u003e The output should consist of a string of the three upper case characters \u0027G\u0027, \u0027B\u0027, \u0027C\u0027 (representing the colors green, brown, and clear) representing the color associated with each bin.\u003c/p\u003e \n\u003cp\u003e The first character of the string represents the color associated with the first bin, the second character of the string represents the color associated with the second bin, and the third character represents the color associated with the third bin.\u003c/p\u003e \n\u003cp\u003e The integer indicating the minimum number of bottle movements should follow the string.\u003c/p\u003e \n\u003cp\u003e If more than one order of brown, green, and clear bins yields the minimum number of movements then the alphabetically first string representing a minimal configuration should be printed.\u003c/p\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003ch2\u003e \u003ca\u003eSample Input\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cpre\u003e\r\n1 2 3 4 5 6 7 8 9\r\n5 10 5 20 10 5 10 20 10\u003c/pre\u003e \n\u003ch2\u003e \u003ca\u003eSample Output\u003c/a\u003e\u003c/h2\u003e \n\u003cp\u003e \u0026nbsp;\u003c/p\u003e \n\u003cpre\u003e\r\nBCG 30\r\nCBG 50\u003c/pre\u003e"}}]}