№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
Название |
---|
you might be declaring a 1-d or 2-d array of size>2*10^6. so for lower values it work fine on local compiler but solution can't be accepted due to size overflow.
Given that it's been 6 months, I'm not sure the OP still needs help. But I would like to point out that 2 * 106 fits comfortably in 512MB.
You were still right about the error though. The OP is creating an array of size N * X. N ≤ 103 and X ≤ 105, which means that 108 long longs will be created. This will cause MLE.
what is solution for this MLE problem ? can you explain please. it would be helpul
The short answer is that you need to write a solution that uses less memory. That's what Memory Limit Exceeded means.
The long answer depends on what solution you have right now.
using Long long int here is causing the memory to exceed the limits , if u look at the constraints they can be met using int only so trying using int instead of long long int and that should solve the issue :)
Thanks man,you are a godsend
pls upvote :""""")
if u are writing a cpp code just dont use long long int , instead use int which takes less memory since MLE is the reason for runtime error . I did the same and it worked , thanks for this post though :)
if u are writing a cpp code just dont use what you don't understand.
long long
is a 64-bit integer type whileint
is a 32-bit integer type (on most computers). This means anint
can contain whole numbers up to an order of $$$10^9$$$ whilelong long
can contain numbers up to something like $$$10^{18}$$$. If your solution may use numbers larger than $$$10^9$$$, you have to uselong long
.what you are saying is exactly correct , but the question he is talking about can be solved easily with int , which is why I suggested it , I suggested him to write int for the specific code, not in general. Although now that i am reading my own post it sounds wrong , nvm my bad. thanks