| element | size |
|---|---|
| e | $$$n$$$ |
| a | $$$S$$$ |
| sp | $$$n$$$ |
| sp_id | $$$\sqrt{S}$$$ |
| sp_qry | $$$Q$$$ |
| qry | $$$Q\cdot 2$$$ |
| nm_qry | $$$Q\cdot\sqrt{S}$$$ |
| ans | $$$Q$$$ |
| mp | $$$K$$$ |
| rua | $$$Q$$$ |
| pp | $$$S$$$ |
| pt | $$$S$$$ |
| pa | $$$n$$$ |
| fa | $$$n$$$ |
| sz | $$$n$$$ |
| ok | $$$n$$$ |
total: $$$6n + 3S + 5Q + K + (Q+1)\cdot \sqrt{S}$$$
if we take $$$3\cdot 10^5$$$ for $$$n,S,Q,K$$$, there would be
which would take $$$\dfrac{168817314\cdot 4}{1024\cdot 1024}=644\enspace\text{MB}$$$
that's way smaller than $$$1\enspace\text{GB}$$$
so why did my code get MLE ???








upd: I got it, nevermind now.