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

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

can someone help me finding incorrect part of my code? any logical error or coding mistake whatever, i would be very thankful.

here's problem : https://codeforces.net/contest/1328/problem/F

and my code : https://codeforces.net/contest/1328/submission/120835066

first, i considered only using operation 1 which is taking minimum element of the array and increase it by 1 - this case is simple, just increasing minimum elements until we have same k elements. second, i considered only using operation 2 which is taking maximum element of the array and decrease it by 1 - this case is same as above. lastly, i considered using both. - for every number num[i] existing in array, calculating the cost of making k equal number whose value is num[i].

i can't pass test case 43 and since there are too many numbers (2e5), i couldn't debug it. i solved this problem about few months ago and i gave up because i couldn't pass test 43. i really wanna know the reason why my code doesn't work.

Полный текст и комментарии »

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

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

problem is this.

https://codeforces.net/contest/1003/problem/F

i can't understand why the answer for test case below is 5

3 abcdef abcdef abcdef

my program (and i ) think A abcdef A is optimal so output 10

vovuh's solution output 5.

how 5 is possible? since we should select non-intersecting segments, at least one abcdef should remain and the answer must >=6. need help for this.

Полный текст и комментарии »

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