ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1048. Superlong Sums

why is my python code TLE? anybody give me some advice
Posted by tryPython 9 May 2013 20:33
my code :
n = input()
num = [0 for i in xrange(n) ]
for i in xrange(n):
    x, y = map(int, raw_input().split())
    num[i] = x+y

cnt = 0
for i in xrange(n-1, -1, -1):
    num[i] += cnt
    cnt = 0
    if num[i] > 9  and i > 0:
        num[i] -= 10; cnt = 1
print ''.join( map(str, num) )
Re: why is my python code TLE? anybody give me some advice
Posted by candide 10 May 2013 03:11
As explained in another post, for the following set of data:

4
9 0
5 4
5 4
5 5

the program has to return:
0000

Your code is wrong since it returns:
10000
Re: why is my python code TLE? anybody give me some advice
Posted by Marius Žilėnas 29 Oct 2013 19:33
The answer to

4
9 0
5 4
5 4
5 5

is 10000.