why the logic fails???↵
↵
↵
I separated the values equal to x from the array and sorted the rest...I took sum=0 and then I used left and right pointers...↵
I checked the left value,if it's >= next multiple of x(starting from 1) then I added up the left value in bonus coins and sum...else ↵
I checked the sum of left and right values...if that's >= next multiple of x...I added up the right value in bonus coins and **left and right values in sum** ...else↵
I just added the left value in sum...↵
problem link-https://mirror.codeforces.com/problemset/problem/2161/C
↵
↵
I separated the values equal to x from the array and sorted the rest...I took sum=0 and then I used left and right pointers...↵
I checked the left value,if it's >= next multiple of x(starting from 1) then I added up the left value in bonus coins and sum...else ↵
I checked the sum of left and right values...if that's >= next multiple of x...I added up the right value in bonus coins and **left and right values in sum** ...else↵
I just added the left value in sum...↵
problem link-https://mirror.codeforces.com/problemset/problem/2161/C



