{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e 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","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003e\r\nTwo finite, strictly increasing, integer sequences are given. Any common integer between the two sequences constitute an intersection point. Take for example the following two sequences where intersection points are\u003cbr\u003eprinted in bold:\r\n\u003c/p\u003e\u003cul\u003e\r\n \u003cli\u003eFirst\u003d 3 5 \u003cstrong\u003e7\u003c/strong\u003e 9 20 \u003cstrong\u003e25\u003c/strong\u003e 30 40 \u003cstrong\u003e55\u003c/strong\u003e 56 \u003cstrong\u003e57\u003c/strong\u003e 60 62\u003c/li\u003e\r\n \u003cli\u003eSecond\u003d 1 4 \u003cstrong\u003e7\u003c/strong\u003e 11 14 \u003cstrong\u003e25\u003c/strong\u003e 44 47 \u003cstrong\u003e55\u003c/strong\u003e \u003cstrong\u003e57\u003c/strong\u003e 100\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003e\r\nYou can ‘walk” over these two sequences in the following way:\r\n\u003c/p\u003e\u003col\u003e\r\n \u003cli\u003eYou may start at the beginning of any of the two sequences. Now start moving forward.\u003c/li\u003e\r\n \u003cli\u003eAt each intersection point, you have the choice of either continuing with the same sequence you’re currently on, or switching to the other sequence.\u003c/li\u003e\r\n\u003c/ol\u003e\r\n\r\n\u003cp\u003eThe objective is finding a path that produces the maximum sum of data you walked over. In the above example, the largest possible sum is 450, which is the result of adding 3, 5, 7, 9, 20, 25, 44, 47, 55, 56, 57, 60, and 62\u003c/p\u003e\r\n\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003eYour program will be tested on a number of test cases. Each test case will be specified on two separate lines. Each line denotes a sequence and is specified using the following format:\u003c/p\u003e\r\n\u003cpre\u003en v1 v2 ... vn\u003c/pre\u003e\r\n\u003cp\u003eWhere n is the length of the sequence and vi is the ith element in that sequence. Each sequence will have at least one element but no more than 10,000. All elements are between -10,000 and 10,000 (inclusive). \u003cbr\u003eThe last line of the input includes a single zero, which is not part of the test cases.\u003c/p\u003e\r\n\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003eFor each test case, write on a separate line, the largest possible sum that can be produced.\u003c/p\u003e\r\n\r\n\u003ch3\u003eSample\u003c/h3\u003e\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\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\u003e13 3 5 7 9 20 25 30 40 55 56 57 60 62\r\n11 1 4 7 11 14 25 44 47 55 57 100\r\n4 -5 100 1000 1005\r\n3 -12 1000 1001\r\n0\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e450\r\n2100\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e"}}]}