PROBLEM LINK:
DIFFICULTY:
SIMPLE
PREREQUISITES:
Strings, Pairs, Dictionaries, Math
PROBLEM:
Find the top 2 teams with maximum scores. If these 2 teams match with given top 2 final teams then Chef is right, else he is wrong.
EXPLANATION:
Problem follows a very naive approach of finding the key value pair of string and integer with maximum value.
Solution given here stores the team name and its goals scored value in a c++ vector of pair. Each pair stores string and integer as its first and second elements respectively.
After taking all the input in the vector, we can simply sort the vector by giving a comparator function. This function will help in sorting according to integer value of pair.
Considering, the sort, it is not necessary for team names to be matched as we have sorted and following are three conditions:

first and second name in reverse sorted list of teams matches with first and second name of final teams respectively.

first and second name in reverse sorted list of teams matches with second and first name of final teams respectively.

there is no match of team names at all.
For above conditions 1 and 2, the answer will be right and for condition 3 the answer will be wrong.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here