### ndpqx's blog

By ndpqx, history, 4 weeks ago,

Can someone help me in this problem please? I debugged it for a while but I can't understand why my code was being MLE :(( Thank you so much. P/S: Sorry for my bad English :( Sub: https://codeforces.com/contest/769/submission/93610574

• -6

 » 4 weeks ago, # |   0 Instead of doing $ok[ check.fi ][ check.se ] = 1;$ after you pop it from the queue, do it while pushing into the queue. Right now your queue can hold many duplicates of some cell $(x,y)$. When you push the first instance of $(x,y)$, you should immediately change the ok status to 1 so that no duplicates of $(x,y)$ enters the queue.
•  » » 4 weeks ago, # ^ | ← Rev. 2 →   +3 Now I'm AC, thank you so much!