why don't compilers like turboc,borland show runtime errors?

so many of my codes that run just fine and give proper answers on compliers like turboc ,borland …happen to segfault ie,give the sigsegv runtime error here when i submit :expressionless: why don’t those compilers show me these errors?

I think you will run your program for sample test cases given in problem. But there are lot of test cases left to test your code. May be for some other cases your code fails and gives Run Time Errors. So issue is not about compilers,it’s your code that fails for some cases. My suggestion is try some other cases(corner cases,boundary cases).

In your solution for TLG, it is clearly stated that n<=10000.

But the size of the array declared by you is only 100.

Now, supposed n=10000. In this array how will your code store a[101] or a[201] or any other value for array index greater than 100, as the size is 100.

Do keep the constraints in mind when you declare variables and arrays.

Same is the case with your turbo sort solution. The constraints in the problem statement clearly that the t<=1000000, meaning your code will be tested on with maximum value of t=1000000.
So,when codechef judge tests the code with the input file having t=1000000, how will you store 1000000 numbers in an array of size 50? You need an array of size 1000001 for this problem to be solved.

The problem with turbo is that it does not support large array sizes like 1000000 and also the sizeof int is 2 bytes because it is a 16 bit compiler. So, start using dev C++, it is good. It can be downloaded very easily.


Most possibly the turbo/borland compilers you are using are very old and from dos era. These may not compliant to modern standard (or even standard).

You should move to some newer compiler and start using it.

Similar questions

thanks a lot.i’d not paid attention to the constraints at all.but now in tlg,even after i’ve declared arrays of size 10001,it says wrong answer.i’m really not able to see where i’m going wrong.
and turbo sort…declaring an array of size 1000001 is resulting in exceeding time limit
how to deal with these constrains in C ?:confused:

I guess you are using insertion sort.

It is an O(n^2) algorithm and will result in time limit exceeding.
[and so are bubble sort and selection sort].

You need an O(n * log(n)) complexity algorithm like merge sort.
Take a look at my answer here, it will help, it is similar,

I will give you a rough estimation, it takes around 1 sec to execute a loop with 10^7 or in some cases around 10^8 iterations at most.

Now, when you use insertion sort. In worst case it will iterate (106)*(106)/2=1012/2 times

or the complexity is O(n^2), so it will roughly execute (10^6)2 ** this i guess explains you how to relate complexity and the no of iterations**.

In case of tlg, for the comparison of the score at some round i, you need to consider the sum of all the scores of the player till this particular round.