Score High solution codechef

Score High solution codechef

Chef is taking a tough examination. The question paper consists of NN objective problems and each problem has 44 options A,B,C,A,B,C, and DD, out of which, exactly one option is correct.

Since Chef did not study for the exam, he does not know the answer to any of the problems. Chef was looking nearby for help when his friend somehow communicated the following information:

  • Exactly NANA problems have option AA as the answer.
  • Exactly NBNB problems have option BB as the answer.
  • Exactly NCNC problems have option CC as the answer.
  • Exactly NDND problems have option DD as the answer.

Note that:

  • Each problem is worth exactly 11 mark and there is no negative marking.
  • Even though Chef knows the number of correct options of each type, he does not know the correct answer to any problem.

Based on the given information, find the maximum marks Chef can guarantee if he marks the answers optimally.

Input Format

  • First line will contain TT, number of test cases. Then the test cases follow.
  • First line of each test case contains an integer NN denoting the number of problems.
  • Second line of each test case contains 44 integers NA,NB,NC,NA,NB,NC, and NDND – as mentioned in the problem statement.
  • Through this contest, selected students get access to a free 6 month LinkedIn Premium subscription which helps students:
    • Discover & apply to 20M+ jobs/internships on LinkedIn
    • Reach out to hiring managers/recruiters/mentors directly
    • Find career paths that people similar to them have taken
    • Learn from over 17K expert-led LinkedIn Learning courses (technical & soft-skills) with certificates

Score High solution codechef

For each test case, output the maximum marks Chef can guarantee if he marks the answers optimally.


  • 1T10001≤T≤1000
  • 1N1051≤N≤105

Sample Input 1

Score High solution codechef

0 0 5 0
7 1 1 1

Sample Output 1 


Score High solution codechef

Test Case 11: Chef knows that all the problems have answer as option CC and thus he will mark all the answers as CC and get 55 marks.

Test Case 22: It will be optimal for Chef to mark all the options as AA which will yield him 77 marks. Thus, irrespective of the answer key, Chef can guarantee 77 marks by marking all answers as option AA.


Click here

Leave a Comment

Your email address will not be published.