Hello. Sometimes I get(no just I i think there are many people) run time error when I submit my code. but there is no error on my system. it is difficult to find why run time error happened because on the website doesn’t mentioned. for example when we get compile error we know that why happened because if there are errors your machine show and we can fix our mistake. but run time error your machine doesn’t show. All admin can you do something that when we get run time error your machine shows us why run time error happening like compile error. for example ideone.com when we check some code if run time error happened machine show that why run time error happened.can you do somehting?
you can go to “My Submissions” and place your mouse on the runtime error symbol then you can see the error code.
When I try solve STRQUERY problem I always get SIGSEGV run time error but I change my code and check other compiler there is no any run time error. but when I submit code chef again I got run time error
this my code I don’t know why this error happened
thanks for your attention. I need some data structures books c/c++/java do you have any suggest?if you have some website or e-book links can you share with me?
@shikimaru >> For Data Structures from the root I will suggest Data Structures Using C and C++ by A. Tenenbaum. There are a lots of other suggestions available on Codechef Discuss only, you might want to browse through. And as @amitupadhyay suggested about gdb, I can suggest you to use some profiler(if you use Linux) which helps you analyze your code.
this answer may help you!
after I get this error I change my code.on my system or ideone.com I checked there is no any error my program run successful. now how can I fix my program?
Generate a random test file using the max value of all constraints given in problem and then try running a solution. In most cases you will come to know more about your mistake
Instead of using ideone try something like this
freopen(“in.txt”,“r”,stdin); //Input file randomly generated
freopen(“out.txt”,“w”,stdout);//Will store the output.
You can also use a timer while debugging your code
printf(“Time: %.2lf sec\n”,(clock()-st)/double(CLOCKS_PER_SEC));
@shikimaru what OS do you use if you use Linux then you can try debugging your program with “gdb” it will tell you the exact line where the program crashed giving runtime error. About gdb google it you will get much details.
I use windows OS
God bless you!
my linux knowledge very little. but I think I must learn linux