CF105A.Transmigration

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In Disgaea as in most role-playing games, characters have skills that determine the character's ability to use certain weapons or spells. If the character does not have the necessary skill, he cannot use it. The skill level is represented as an integer that increases when you use this skill. Different character classes are characterized by different skills.

Unfortunately, the skills that are uncommon for the given character's class are quite difficult to obtain. To avoid this limitation, there is the so-called transmigration.

Transmigration is reincarnation of the character in a new creature. His soul shifts to a new body and retains part of his experience from the previous life.

As a result of transmigration the new character gets all the skills of the old character and the skill levels are reduced according to the kk coefficient (if the skill level was equal to xx , then after transmigration it becomes equal to [kx][kx] , where [y][y] is the integral part of yy ). If some skill's levels are strictly less than 100100 , these skills are forgotten (the character does not have them any more). After that the new character also gains the skills that are specific for his class, but are new to him. The levels of those additional skills are set to 00 .

Thus, one can create a character with skills specific for completely different character classes via transmigrations. For example, creating a mage archer or a thief warrior is possible.

You are suggested to solve the following problem: what skills will the character have after transmigration and what will the levels of those skills be?

输入格式

The first line contains three numbers nn , mm and kk — the number of skills the current character has, the number of skills specific for the class into which the character is going to transmigrate and the reducing coefficient respectively; nn and mm are integers, and kk is a real number with exactly two digits after decimal point ( 1<=n,m<=201<=n,m<=20 , 0.01<=k<=0.990.01<=k<=0.99 ).

Then follow nn lines, each of which describes a character's skill in the form " namename expexp " — the skill's name and the character's skill level: namename is a string and expexp is an integer in range from 00 to 99999999 , inclusive.

Then follow mm lines each of which contains names of skills specific for the class, into which the character transmigrates.

All names consist of lowercase Latin letters and their lengths can range from 11 to 2020 characters, inclusive. All character's skills have distinct names. Besides the skills specific for the class into which the player transmigrates also have distinct names.

输出格式

Print on the first line number zz — the number of skills the character will have after the transmigration. Then print zz lines, on each of which print a skill's name and level, separated by a single space. The skills should be given in the lexicographical order.

输入输出样例

  • 输入#1

    5 4 0.75
    axe 350
    impaler 300
    ionize 80
    megafire 120
    magicboost 220
    heal
    megafire
    shield
    magicboost
    

    输出#1

    6
    axe 262
    heal 0
    impaler 225
    magicboost 165
    megafire 0
    shield 0
    
首页