Time Limit!!! for UVa 11340 Newspaper

Правка en2, от Ishtiaq11, 2016-07-20 17:55:03

Please help me to overcome time limit.

Problem Link: UVa 11340 Newspaper

My Solution:

from sys import stdin,stdout
dd = dict()

tests = int(input().strip() )

for t in range(tests):
    dd.clear()
    sm = 0.0
    m = int(input().strip())
    for x in range(m):
        ch,vl = input().strip().split()
        dd[ch]=float(vl)
    for x in range(int(input())):
        line=input()
        for letter in line:
            if letter in dd:
                sm += dd[letter]
    print('%0.2f$' %(sm/100.0))
        

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Ishtiaq11 2016-07-20 18:26:00 2
en3 Английский Ishtiaq11 2016-07-20 18:25:06 28
en2 Английский Ishtiaq11 2016-07-20 17:55:03 27 (published)
en1 Английский Ishtiaq11 2016-07-20 17:53:40 685 Initial revision (saved to drafts)