{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eThere are \u003cvar\u003e\\(N\\)\u003c/var\u003e items, numbered \u003cvar\u003e\\(1, 2, \\ldots, N\\)\u003c/var\u003e.\r\nFor each \u003cvar\u003e\\(i\\)\u003c/var\u003e (\u003cvar\u003e\\(1 \\leq i \\leq N\\)\u003c/var\u003e), Item \u003cvar\u003e\\(i\\)\u003c/var\u003e has a weight of \u003cvar\u003e\\(w_i\\)\u003c/var\u003e and a value of \u003cvar\u003e\\(v_i\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eTaro has decided to choose some of the \u003cvar\u003e\\(N\\)\u003c/var\u003e items and carry them home in a knapsack.\r\nThe capacity of the knapsack is \u003cvar\u003e\\(W\\)\u003c/var\u003e, which means that the sum of the weights of items taken must be at most \u003cvar\u003e\\(W\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eFind the maximum possible sum of the values of items that Taro takes home.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eAll values in input are integers.\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq N \\leq 100\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq W \\leq 10^5\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq w_i \\leq W\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq v_i \\leq 10^9\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(W\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(w_1\\)\u003c/var\u003e \u003cvar\u003e\\(v_1\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(w_2\\)\u003c/var\u003e \u003cvar\u003e\\(v_2\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(w_N\\)\u003c/var\u003e \u003cvar\u003e\\(v_N\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the maximum possible sum of the values of items that Taro takes home.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 8\r\n3 30\r\n4 50\r\n5 60\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e90\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eItems \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(3\\)\u003c/var\u003e should be taken.\r\nThen, the sum of the weights is \u003cvar\u003e\\(3 + 5 \u003d 8\\)\u003c/var\u003e, and the sum of the values is \u003cvar\u003e\\(30 + 60 \u003d 90\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e5 5\r\n1 1000000000\r\n1 1000000000\r\n1 1000000000\r\n1 1000000000\r\n1 1000000000\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5000000000\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eThe answer may not fit into a 32-bit integer type.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6 15\r\n6 5\r\n5 6\r\n6 4\r\n6 6\r\n3 5\r\n7 2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e17\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cp\u003eItems \u003cvar\u003e\\(2, 4\\)\u003c/var\u003e and \u003cvar\u003e\\(5\\)\u003c/var\u003e should be taken.\r\nThen, the sum of the weights is \u003cvar\u003e\\(5 + 6 + 3 \u003d 14\\)\u003c/var\u003e, and the sum of the values is \u003cvar\u003e\\(6 + 6 + 5 \u003d 17\\)\u003c/var\u003e.\u003c/p\u003e\u003c/section\u003e\r\n"}}]}