Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

### arham_doshi's blog

By arham_doshi, history, 12 days ago, ,

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

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 .

• +1

 » 12 days ago, # |   +9 You have takenint 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.
•  » » 12 days ago, # ^ |   0 i have declared int = long long in macro
 » 12 days ago, # |   +7 v[0]=a; int mxx=-1e12; fo(i,1,n+1){ if(v[i]==-1)v[i]=a; mxx=max(mxx,abs(v[i]-v[i-1])); } You are using v[1]-a to compute min and Max Everytime. Even when the input array doesn't start with -1
•  » » 12 days ago, # ^ |   0 thank you so much sir i have tried to remove that error but still it is giving wa on same tc my new code
•  » » » 12 days ago, # ^ |   +7 if(v[i]!=-1&&v[i-1]==-1) { // cout<
•  » » » » 12 days ago, # ^ |   0 ooh thanks let me try
•  » » » » 12 days ago, # ^ |   0 thank you so much it worked ac .