Jul 22, 2015, 04:00 PM UTC (UTC) - Jul 22, 2015, 06:30 PM UTC (UTC)
Language | Version | Flags/Notes | Max Memory Limit |
C | gcc 4.8.1 | Flags: -std=gnu99 -w -O2 -fomit-frame-pointer -lm | 256 MB |
C++ | g++ 4.8.1 | Flags: -std=c++0x -w -O2 -fomit-frame-pointer -lm | 256 MB |
C# | Mono C# compiler 2.10.8.1 | Time Limit: 2X Flags: -unsafe+ -warn:0 Runtime: .Net 4.0 |
256 MB |
Clojure | Clojure 1.1.0 | Time Limit: 3X | 256 MB |
Haskell | GHC 7.4.1 | Time Limit: 3X | 256 MB |
Java | Java 1.7.0_09 | Time Limit: 2X Flags: -Xmx1024M -Xms128M |
256 MB |
JavaScript | Rhino 1.7 | Time Limit: 5X | 256 MB |
Objective-C | gcc 4.8.1 | Flags: -std=gnu99 -w -O2 -fomit-frame-pointer -Wno-import -lobjc -lm | 256 MB |
Perl | Perl 5.14.2 | Time Limit: 5X | 256 MB |
PHP | PHP 5.3.10 | Time Limit: 5X | 256 MB |
Python | Python 2.7.3 | Time Limit: 5X | 256 MB |
Ruby | Ruby 2.1.1 | Time Limit: 5X | 256 MB |
Legend | Explanation |
NZEC | Non Zero Exit Code |
SIGSEGV | Segmentation Fault |
SIGFPE | Floating Point Error |
SIGABRT | Fatal Error |
SIGXFSZ | Output is too large |
TLE | Time Limit Exceeded |
MLE | Memory Limit Exceeded |
RE | Runtime Error |
CE | Compilation Error |
Your code is tested by a code-checker automatically, not by a human being, and you have to write your code accordingly.
For each problem, there will be one or more input files, each according to the specifications mentioned in the problem statement, and corresponding correct output files. Your program is run on each of the input files by redirecting the standard input stream to an input file, and the standard output stream to another file. The output generated by your program must match the correct output *exactly* in order to be judged correct.
Note that your program must read from stdin and print to stdout. This means using scanf/printf in C, cin/cout in C++ and similarly in other languages.
If your program starts by printing 'Enter the number' and the problem does not tell you to do so, then since this is not part of the correct output, you will be never be judged correct regardless of what the rest of your program does. As all that matters is that the output files match, it makes no difference at all at what point in your program's execution that this output is written. So there is no need to read all of the input before starting output; it is much more common to just print out each result as you are reading through the input. If you use any method other than using the standard input and output streams - for example, using command line arguments, reading from a file, opening up some sort of dialog box, or otherwise - you will never be judged correct.
Testing your program in exactly the same way
that online judge does. Create an input file and then run
your program from the command line, using < and > to redirect the streams.
For example:
./a.out < input > output
Your program will read input from the `input` file and print output in the
`output` file. You can check if the output format is correct in the
`output` file. It should exactly match the output format give in the
problem statment.
Your program must read, process, and output the result for all input files
within the specified time limit. The input file will be of the format
mentioned in the problem.
This means, if each of the input file contains multiple test cases, your code must
complete all of these within that time limit. If the time limit is 1
second, and there may be 100 test cases and multiple input files, your program shouldn't be taking
1 second per test case - it needs to run all 100 in under 1 seconds.
Some programming languages are slower than others, and are thus given more
time.
Also all the input files are processed, irrespective of whether the first
input file passed or not.
Your code is tested multiple times with different input files.
The execution time displayed is the total of the time spent for each
input file. But your program is terminated if it exceeds the time limit
mentioned in the problem while processing any input file. Hence,
Total execution time <= (Time Limit * Number of input files)
Total memory consumed by the program is sum of the memory consumed by
program in stack, data, heap, and bss. See this image or this explanation to understand
the address space of a program and the memory consumed.
Note that for languages like Java, Scala, JavaScript, etc. where runtime
environment is initialized before the program could be executed, the total
memory displayed could be much higher. Hence the memory limit is usually
not considered for these languages, except in extreme cases where the
program is consuming too much of memory.
C/C++
Make sure you are using a compiler that complies with the standards. Turbo
C++ is not such a compiler, and often code which compiles in Turbo C++
will not compile on the online judge. For the starter, remove conio.h
includes in your code.
Java
Make sure your class is not public, and there is only a single class in
the file. There should be a main function inside this class. Even class
inside class are not allowed.
Please note that we will remove this constraint very soon. We will
update you when this happens.
In case of other languages, see the compilation error you receive. This
should give you ample idea of what might be the reason. If you still think
compilation error is weird, contact me.
The most common reason that you would get a Time Limit Exceeded is because
your program is too slow. If a problem tells you that N <= 999999, and
your program has nested loops each which go up to N, your program will
never be fast enough. Read the bounds in the input carefully before
writing your program, and try to figure out which inputs will cause your
program to run the slowest.
The second most common cause of TLE is that your method of reading input
and writing output is too slow. In Java, do not use a Scanner; use a
BufferedReader instead. In C++, do not use cin/cout - use scanf and printf
instead. In C++, you can also avoid using STL, which can be a
little slow sometimes.
Also note that our judge might be slower than your machine, but the time
limit is always achievable. It is common for a program to take 2-3 times
as long on the judge as it does on your computer. You need to come up with
faster algorithms to achieve the execution with time limit.
Also in case of TLE, it is not guaranteed that whether the solution was
correct or not. There is also no way of knowing how many more seconds it
could have taken to finish.
Wrong answer means simply that your program is not printing out the correct answer. Make sure your program is conforming exactly to the output format required, and not printing out unnecessary information.
Runtime error is usually caused when your program throws an exception, or
is printing too much to the output stream, or returns a non-zero status.
SIGSEGV
This is an error caused by an invalid memory reference or segmentation
fault. The most common causes are accessing an array element out of
bounds, or using too much memory.
No, you can't. Similarly, no one can view your solution.
There might be many submissions by many users right now. So it will take
some time in processing all of them. But you will get the result of your
submission in real-time as soon as that gets processed.
Sometimes our code-checker servers or webservers might be under maintenance. As soon
as that gets over, your submissions will be judged automatically.
If all this still doesn't answer your question, shoot me a mail at vivek@hackerearth.com. But it might happen that I redirect you to this page again :)