Блог пользователя arham_doshi

Автор arham_doshi, история, 4 года назад, По-английски

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 .

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +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.

»
4 года назад, # |
  Проголосовать: нравится +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