PROBLEM LINK:
Practice
Contest: Division 1
Contest: Division 2
Contest: Division 3
Contest: Division 4
Author: notsoloud
Tester: mexomerf
Editorialist: iceknight1093
DIFFICULTY:
TBD
PREREQUISITES:
None
PROBLEM:
Chef participates in a weightlifting competition, which consists of three rounds.
He gets two attempts in each round, and his final score is the sum of the best of both attempts across all three rounds.
Compute Chef’s score.
EXPLANATION:
The best score in the first round is \max(A_1, A_2).
Similarly, the best scores in the second and third rounds are \max(B_1, B_2) and \max(C_1, C_2), respectively.
Thus, the final answer is
\max(A_1, A_2) + \max(B_1, B_2) + \max(C_1, C_2)
TIME COMPLEXITY:
\mathcal{O}(1) per testcase.
CODE:
Editorialist's code (Python)
a1, a2, b1, b2, c1, c2 = map(int, input().split())
print(max(a1, a2) + max(b1, b2) + max(c1, c2))