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

WA4 - Memory limit exceeded HELP ME
Posted by supanat 28 Apr 2016 07:56


Edited by author 05.05.2016 19:23
Re: WA4 - Memory limit exceeded HELP ME
Posted by ToadMonster 28 Apr 2016 12:55
I think string is: result = str(b) +result
During this operation:
- new string with size  = result.size+1 created;
- b contents copied to new string
I am not sure about memory but it must lead to TLE.

You know your n1, n2, result strings have known size = n.
You should rather use efficient byte arrays of size n to store n1, n2, result contents

Edited by author 28.04.2016 13:22
Re: WA4 - Memory limit exceeded HELP ME
Posted by konstdev 5 Apr 2021 19:15
if You get TLE verdict, U can try to use short instead of int