Hey guys, I wrote this program which compiles and runs properly on my computer. However when others run/compile it, they get a runtime error. Since I get no errors, I cannot see what is causing the runtime error so I cannot fix it. Here is the link http://ideone.com/fX5IkG
My guess is that you didn't supply input with your code, and since it requires input, it just hung until it was killed.
But the problem is that I'm not the one supplying input, I submit it and it is the website that gives it input and tests it. It works fine for me, but when I submit, they just spit back runtime error; so that's just confusing
You could also start outputting markers in your code to determine where it stopped.
It doesn't stop for me, just when I submit it hence my dilema. I don't want to go asking on the website because frankly no one there cares enough, all they do it down-vote your post...it's nonsense
First, what's with the pointers and pointers-to-pointers where they aren't needed? Use container classes.
1 2
action[c] = new (nothrow)int[n+1];
memset(action[c], 0, sizeof action[c]);
I don't think this is doing what you think it's doing.
1 2
action[c] = newint[n+1] ; // Don't use nothrow if you aren't going to check the return value.
memset(action[c], 0, sizeof(action[c][0]) * (n+1)) ;
That likely resulted in for (int i = 0; action[p][i] >= 0; ++i) exceeding the bounds of the array. It may still exceed it, of course, I haven't spent much time examining your code.