logo AlgoBeat OnlineJudge
登录 注册

#216907. [NWERC 2017] Dunglish

内存限制:512 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

From Northwestern Europe Regional Contest (NWERC) 2017 Problem D.

Original problem license: CC BY-SA.


A confused Dutchman trying to speak English could say "I am in the war", even though there is no hostile activity going on. The confusion here is that the English sentence "I am confused" is translated in Dutch as "Ik ben in de war", which is phonetically ("sounding") quite close to the first sentence. Such confusion leads to much enjoyment, but can complicate matters a bit.

Given a sentence in Dutch and a dictionary containing both correct translations as well as phonetic (incorrect) translations of individual words, find the translation of the sentence and indicate whether it is correct, or in case there is more than one find the total number of correct and incorrect translations. A sentence is correctly translated when each word of the sentence is correctly translated.

输入格式

The input consists of:

  • One line with an integer (), the number of words in the Dutch sentence.
  • One line with words, the Dutch sentence .
  • One line with an integer (), the number of words in the dictionary.
  • lines, each with three strings , and , a Dutch word, the English translation, and correct if this is the correct translation or incorrect otherwise.

输出格式

In case there is only a single translation of , output one line with the translation followed by one line with correct or incorrect. In case there is more than one translation, output one line with the number of possible correct translations followed by correct, and one line with the number of possible incorrect translations followed by incorrect.

样例

样例输入 1

7
als mollen mollen mollen mollen mollen mollen
4
als when correct
mollen moles correct
mollen destroy correct
mollen mills incorrect

样例输出 1

64 correct
665 incorrect

样例输入 2

5
de zuigers zijn buiten werking
6
zijn are correct
banaan banana correct
de the correct
zuigers suckers incorrect
buiten out correct
werking working incorrect

样例输出 2

the suckers are out working
incorrect

数据范围与提示

A word consists of between and lowercase letters. Each word in appears at least once as a Dutch word in the dictionary, no word appears more than times as a Dutch word in the dictionary, and each combination of a Dutch and English word appears at most once.