Блог пользователя cacophonix

Автор cacophonix, 12 лет назад, По-английски

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).

  • Проголосовать: нравится
  • +53
  • Проголосовать: не нравится

»
12 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I don't see any number specifying new stack size. Is it inifinity? Or do I need to write something like:

rlimit R = some_value;
»
11 лет назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

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

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I am shocked, Codeforces servers are not linux XD

»
11 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

is there any danger of doing it?

  • »
    »
    11 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +2 Проголосовать: не нравится

    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).