## UTS Open '18 P2 - ABCs

View as PDF

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

You have 3 sequences , , and , each containing 3 integers. A subsequence of is valid if for each in the subsequence, = (indices are taken mod 3, so ).

What is the maximum sum of a valid subsequence of ?

#### Input Format

The first row contains , the second row contains , and the third row contains .

for all .

#### Output Format

Output the maximum sum of a valid subsequence of (The subsequence can be empty, in which case the sum would be 0).

#### Sample Input

5 6 5
6 5 6
6 1 4

#### Sample Output

5

#### Explanation for Sample Output

Since and , and are valid and can be included in the subsequence. However, , so cannot be included in the subsequence. This subsequence has sum 5.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5954585671424866, "perplexity": 1611.1158984842175}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-47/segments/1542039742968.18/warc/CC-MAIN-20181116004432-20181116030432-00299.warc.gz"}