Mohammad7892's blog

By Mohammad7892, history, 4 years ago, In English

Link to the problem

My submission

In checker log it is showing that wrong answer 2 * (sum |ai-bi|) > sum ai (test case 7) but in test case 7 according to my output 2 * (sum |ai-bi|) is equal to 70 and sum ai is equal to 137 and clearly 2 * (sum |ai-bi|) < sum ai and my output is satisfying all the conditions then also it is showing it is wrong due to some reason which is completely wrong. How to resolve this issue?

  • Vote: I like it
  • +8
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

lol, 70 * 2 is bigger than 137, am I mistaken?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i have said that 2 * (sum |ai-bi|) is equal to 70 and not (sum |ai-bi|)

    • »
      »
      »
      4 years ago, # ^ |
      Rev. 3   Vote: I like it 0 Vote: I do not like it

      Check,2020-12-18 again, on my end sum |ai - bi| is 70, so 2 times that is 140.

      Edit: disregard, I was mistaken

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        ai = 1 5 9 2 2 5 4 10 9 2 1 2 2 1 5 10 4 5 4 4 10 9 1 10 10 10 =137

        my output = 1 5 1 2 1 5 1 10 1 2 1 2 2 1 5 10 1 5 1 4 1 9 1 10 10 10

        |ai-bi| = 0 0 8 0 1 0 3 0 8 0 0 0 0 0 0 0 3 0 3 0 9 0 0 0 0 0 = 35

        2*sum|ai-bi| =2*35 =70

        I have checked it multiple times and 2*sum|ai-bi| is equal to 70 and not sum|ai-bi|

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In test case $$$6$$$, $$$n = 14$$$, but you write $$$13$$$ integers.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yeah I found out that there is some error in my logic some answer can be wrong but test case 7 is definitely not wrong as shown by the checker log which is misleading.If it has shown a genuine test case which is wrong then I whouldn't have spent time to figuring out why it is showing a correct output is wrong.

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      All a[i] in test case $$$7$$$ are shifted by one position, because an a[i] in test case $$$6$$$ is missing.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        oh thanks now i see where the problem lies. Thanks for help.