Jul 02, 2016, 01:30 PM UTC (UTC) - Jul 02, 2016, 07:30 PM UTC (UTC)

Databases Supported

Database Version
MySQL MySQL 5.6
PostgreSQL PostgreSQL 9.5
SQL Server SQL Server 2014

Legends

Legend Explanation Icons
RE Execution Failed/Runtime Error
CV Constraints Violated

How does the judge work:

When you submit your query, We setup a new database, create tables, load data specified in the test case. Then, We execute your query on the freshly set up database and compare the result with expected output. If it matches, It is an Accepted Submission (AC). If it does not match, It is a Wrong Answer (WA). Check out the LEGEND on various output results.

How does online judge determines whether the solution is correct?

Your code is tested by a HackerEarth SQL Service 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 those input files. The output generated by your queries must match the correct output exactly in order to be judged correctly. So your statements must be in order.

If your queries start by echoing 'Enter the number' and the problem does not tell you to do so, then since this is not part of the correct output, your script will be never be judged as correct submission regardless of what the rest of your queries do. 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 - your code will never be judged as correct submission.

How does the total execution time work?

Your queries are tested multiple times with different data in the tables. The execution time displayed is the total time spent in executing your queries against the database collectively. But your queries are 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)

What are the problem constraints?

Your queries are constrained in following ways:

  • Maximum Tables per Database is constrained, You cannot create more tables than what is specified in the problem.
  • Maximum Rows per Table is constrained. You cannot insert more rows in a table than what is specified in the problem.
  • Your queries collectively have a hard time limit of 5 sec.

Why my program gives CV?

Your queries violated one of the above constraints mentioned.

TLE means my code is correct but slow, right? Why do I get Time Limit Exceeded?

No, Time Limit Exceeded or TLE means that your solution exceeded the amount of time which was determined for the problem or for that particular test case. Your solution never finished running in time, it was stopped in between. So, there is no definite way to say if the code was correct or not.

At times, this means that your SQL script may contain sleep, and your queries will never stop executing. In other cases, it may mean that your code will terminate, but not within the time limit indicated.

For example, if the time limit of an SQL script is 2 seconds, and your script terminates on 2.001 seconds, it does NOT mean that it exceeded the limit by 0.001 seconds, it simply means that the judge stopped evaluating your code after 2 seconds.

What is Wrong Answer?

Your script ran successfully but gave an incorrect answer. Most probably your SQL script contains a bug, or you are not interpreting the problem text correctly. If your code shows that it has passed the sample input correctly, then remember that there are multiple input and output cases for which your SQL script is supposed to be evaluated, which is why in spite of passing the sample input cases, you’re still getting a wrong answer.

I keep getting various types of runtime errors, I’m sick of them. What am I missing?

A runtime error means that the program was compiled successfully, but it exited with a runtime error or crashed. You will receive an additional error message, which is most commonly one of the following:

RE

The Error means your query execution failed.

Some ways to avoid runtime errors:

  • Make sure your queries are syntactically correct.
  • Make sure your script is not violating any of the problem constraints.

CV

The error means you have violated one of the problem constraints. Most common reasons are:

  • You have created too many tables.
  • You have inserted too many rows inside a table.

Max number of tables and Max number of rows per table are restricted.

Can I view other's solutions?

No, You can't. Similarly, No one can view your solution.

Why is my submission queued?

There might be many submissions by many users. Sometimes our code-checker servers or web servers might be under maintenance. As soon as that gets over, your submissions will be judged automatically.

The submissions are not getting evaluated, what should I do?

There might be an issue with the judge, contact a website admin asap. Drop a mail to vivek@hackerearth.com, or arjit@hackerearth.com.

How can I share my code?

You won't want to do that ideally. During contest if your code becomes public, Your account can be suspended, if detected for plagiarism.

Comments:

If you think that some problem has an incorrect test data, its specification isn't clear or in your opinion something in the problem needs clarification, post a comment on the bottom of the problem's page. While posting comments, please keep the following things in mind:

  • Do NOT spam.
  • Don't post any source code. Be it your wrong solution, or an accepted solution.
  • Admins / Moderators are allowed to delete the comments.

If all this still doesn't answer your question, drop us an email at support@hackerearth.com.

?