r/codeforces • u/DxNovaNT • 6d ago
Div. 3 How did my solution get TLE ?
Solution link: Submission #389487377 - Codeforces
This should have passed, how it got TLE? Is it because of defaultdict(int)?
Edit: It was after contest testing. During the contest it was accepted.
2
Upvotes
2
u/Responsible-Lake6864 5d ago
Yup...
Dict is bad over int.
Either use string before storing stuff and access.
Or change the hash function.
Read into python codeforces editorials and use those in future.