Login to HOJ

Username
Password

F.A.Q

On 2011 年 08 月 28 日, by 段 志岩


Q:What is the compiler the judge is using and what are the compiler options?
A:The online judge system is running on Linux. We are using GNU GCC/G++ for C/C++, Free Pascal for Pascal and Sun JDK 1.6 for Java. The compile options are:
C: gcc -DONLINE_JUDGE -g0 -O2 –static -Wall -ansi -std=c89 -fno-asm -o
C++: g++ -DONLINE_JUDGE -g0 -O2 –static -Wall -ansi -fno-asm -fno-rtti -fno-exceptions -lm -o
Free Pascal(FPC): fpc -dONLINE_JUDGE -WC -XS -Xt -vwlb -o
Java: No special options
Our compiler software version:
gcc/g++ 4.1.2 20080704 (Red Hat 4.1.2-51)
glibc 2.5-65
Free Pascal Compiler version 2.2.2 [2008/11/05] for i386
java version “1.6.0_20”


Q:Why did I get a Compile Error? It’s well done!
A:There are some differences between GNU and MS-VC++, such as:

  • main must be declared as intvoid main will end up with a Compile Error.
  • i is out of definition after block “for(int i=0…){…}”
  • itoa is not an ANSI function.
  • __int64 of VC is not ANSI, but you can use long long for 64-bit integer.

Q:How to submit a Java solution?
A: See the sample solution above. Basically you should submit a single source file which contains a public class Main and it should have a method with signature “public static void main(String[] args)” which is the entry of your program.


Q:Which Java classes can I use?
A: You can only use classes in those packages: java.lang, java.io, java.nio, java.math, java.util, java.text and java.net. You are not allowed to catch any Error in your try-catch, read, write or create any file, or create Socket, etc. In one word, don’t do anything other than solving the problem.


Q:Is there any way to determine if my program is runned at Online Judge or not ?
A: There is a conditional define of compiler called ONLINE_JUDGE. Example of using:

C/C++

#ifdef ONLINE_JUDGE
running on online judge
#endif

Pascal

{$IFDEF ONLINE_JUDGE}
running on online judge
{$ENDIF}


Q:What does “Special Judge” mean ?
A: When a problem has multiple acceptable answers, a special judge program is needed. The special judge program uses the input data and some other information to check your program’s output and returns the result to the judge.


Q:How to use 64-bit integer types ?
A: Please do not use the %I64d specificator to read or write 64-bit integers in С++. It is preferred to use the %lld specificator.


Q:What is the maximal size of program that can be submitted ?
A: The maximal size of program is 102400 characters.