Time Limit!!! for UVa 11340 Newspaper

Revision en3, by Ishtiaq11, 2016-07-20 18:25:06

Please help me to overcome time limit.

Problem Link: UVa 11340 Newspaper

My Code: ~~~~~ 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)) ~~~~~

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Ishtiaq11 2016-07-20 18:26:00 2
en3 English Ishtiaq11 2016-07-20 18:25:06 28
en2 English Ishtiaq11 2016-07-20 17:55:03 27 (published)
en1 English Ishtiaq11 2016-07-20 17:53:40 685 Initial revision (saved to drafts)