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

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

It would be nice to have a CODEFORCES environment variable, to allow our programs to print debug output selectively.


Currently I use my own variable to control debug output, but have to turn it off when submitting to CF. For difficult problems where I submit many times (during practice), it'd be nice to not have to turn that variable on, off, on, off, repeatedly. So some mechanism for the program to detect it is running on CF server, would be great. 

Thanks for the nice platform and great problems.



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

13 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится
There is such env. variable, but called "ONLINE_JUDGE"
13 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
what is environment variable?
Its use?
  • 13 лет назад, # ^ |
    Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

    C++ example:

    #ifndef ONLINE_JUDGE
    cout<<"Some debug output";
    cout<<"It will not be used in CF server";
    //You can add freopen's here to use file input/output on your local machine
    #endif
13 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
In fact, it's not an environment variable. It's preprocessor's macro/definition.
Environment variable is like PATH or HOME:

printf("PATH=%s", getenv("PATH"));