my code here is similar to tutorials code my logic is same and i am getting wa. tutorials code Your text to link here...
can you please tell what is wrong in my code or i am wa on 2nd testcase 581 th sub test case , can you tell me testcase were my code fails
thanks in advance.
story(if you want to read) i was solving this question and i got wa on contest , i thought that my logic would be wrong and i moved to next question .then i again saw the tutorial and i got exactly same logic , i again wrote the code(after seeing tutorial) and again wa .i compared my code here and tutorials code Your text to link here... and i couldn't find the difference .
You have taken
int mx = -1e12 , mn = 1e12
. I fear that int cannot hold a value that big(or small) and thus overflow might be a reason for your code's WA.i have declared int = long long in macro
You are using v[1]-a to compute min and Max Everytime. Even when the input array doesn't start with -1
thank you so much sir i have tried to remove that error but still it is giving wa on same tc my new code
when first element of input array is !=-1, You are using it to compute min and max.
ooh thanks let me try
thank you so much it worked ac .