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 1799. Sasha and swag strings

WA #8, WA #19 & TLE #23
Posted by 👨🏻‍💻 Spatarel Dan Constantin 30 Oct 2019 03:02
I managed to get rid of WA using these two test cases:

in:
1
dcbbbdbdbbacaaaddbdcbbbdbbdbbadacbbaaddbaddbddacaa
out:
15577

in:
1
abcccacccbcabaaaacbbabbcaaaaacaaaaacaacacbbacbcaba
out:
15236

In test #23 it seems that n is large. So, to pass TLE #23, make sure your code is running fast enough for n = 100 000 and each test contains a single letter.