You need to include a header file
#include <sys/resource.h>
and in the main() function you need to write these lines
rlimit R;
getrlimit(RLIMIT_STACK, &R);
R.rlim_cur = R.rlim_max;
setrlimit(RLIMIT_STACK, &R);
thanks(not this line).
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
You need to include a header file
#include <sys/resource.h>
and in the main() function you need to write these lines
rlimit R;
getrlimit(RLIMIT_STACK, &R);
R.rlim_cur = R.rlim_max;
setrlimit(RLIMIT_STACK, &R);
thanks(not this line).
Название |
---|
I don't see any number specifying new stack size. Is it inifinity? Or do I need to write something like:
This line
R.rlim_cur = R.rlim_max;
does what you're asking about.Tried printing the value of
R.rlim_max
and got18446744073709551615
, so yeah it's probably infinity.More info?
In my machine, the value of R.rlim_max is 4294967295(Byte). So the stack size is 4GB in my machine.
I tried this, but the Codeforces compiler couldn't find the header.
program.cpp:50:26: fatal error: sys/resource.h: No such file or directory
Because it is not linux. However stack size is large enough on codeforces.
I am shocked, Codeforces servers are not linux XD
is there any danger of doing it?
These calls may be forbidden on some online judges or offline competitions, as they're unusual system calls. So, you theoretically can be disqualified, if jury will think that such calls violate competition rules. From practical point of view, you may bump into compilation error or runtime error (for the same reasons — these calls can be banned).