Given a Dutch sentence and per-word dictionary options marked correct or incorrect, output the unique translation and its status, or counts of correct and incorrect translations.
Medium5ImplementationMathCombinatoricsNo attempts yetTime limit2sMemory limit512 MBA Dutchman who is unsure of his English might say "I am in the war", even though no fighting is going on anywhere. The English sentence "I am confused" becomes "Ik ben in de war" in Dutch, and that Dutch sentence sounds a lot like the first one. Mix-ups like this one are funny (pun intended), and they also make it harder to work out what the speaker meant.
You are given a sentence in Dutch and a dictionary. The dictionary lists translations of single words, and every entry says whether it is the correct translation or a phonetic, incorrect one. A translation of the sentence replaces each word of the sentence by one of that word's dictionary entries, keeping the word order. Such a translation is correct when every word in it was translated correctly.
When the sentence has exactly one translation, report it and say whether it is correct. When it has more than one, count how many of the translations are correct and how many are incorrect.
The first line contains an integer n (1≤n≤20), the number of words in the Dutch sentence.
The second line contains the n words of the Dutch sentence s, separated by single spaces.
The third line contains an integer m (1≤m≤105), the number of entries in the dictionary.
Each of the next m lines contains three strings d, e and c: a Dutch word, its English translation, and the word "correct" if this is the correct translation or "incorrect" otherwise.
Every word consists of 1 to 20 lowercase letters. Every word of s appears at least once as a Dutch word in the dictionary, no word appears more than 8 times as a Dutch word in the dictionary, and each combination of a Dutch word and an English word appears at most once.
When s has exactly one translation, print that translation on one line, then print "correct" or "incorrect" on the next line.
When s has more than one translation, print the number of correct translations followed by a single space and the word "correct" on one line, then the number of incorrect translations followed by a single space and the word "incorrect" on the next line.