I need help (again)

Revision en4, by pickle_juice2024, 2024-03-12 17:40:03

I am currently solving 1893C: https://codeforces.net/contest/1893/problem/C. For some strange reason my code gives MLE when the space complexity of my code is O(n + m) (at least I think so?). If anyone could help me, it would be highly appreciated. My code:

Spoiler

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en6 English pickle_juice2024 2024-03-14 04:26:05 1 Tiny change: 'roblem/C. \nFor som' -> 'roblem/C. \nFor som'
en5 English pickle_juice2024 2024-03-12 17:40:16 0 (published)
en4 English pickle_juice2024 2024-03-12 17:40:03 4 Tiny change: 'think so?)\nIf anyon' -> 'think so?).\nIf anyon'
en3 English pickle_juice2024 2024-03-12 17:39:50 4 Reverted to en1
en2 English pickle_juice2024 2024-03-12 17:39:02 4 Tiny change: 'think so?)\nIf anyon' -> 'think so?).\nIf anyon' (saved to drafts)
en1 English pickle_juice2024 2024-03-12 05:08:42 2635 Initial revision (published)