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

Автор daiict218, история, 7 лет назад, По-английски

Hi,

In the above problem, I tried using the method of diving an array in two subsets with minimum difference but it gave me wrong answer for the test case

5
110 90 70 50 40

For me, the answer should be that one person would take pizza with sector angles 90,40 and 50 and other person will take sectors 110 and 70. Did I understand the problem incorrectly?

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

»
7 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Hi, you understood the problem incorrectly. You don't have to divide into subsets. You have to divide it into contiguous subarrays.

»
7 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

And how about this test case?

4
170 30 150 10

The answer is 0 for this and described in problem statement.

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    The answer is 0 because is a pizza, the array is like a circle.

    170] [30 150] [10

    So the two groups sum 180

»
7 лет назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

Anyway, it was the worst formatting of language. The problem statement should be more clear because not all the people know English that well.

  • »
    »
    7 лет назад, # ^ |
      Проголосовать: нравится +7 Проголосовать: не нравится

    The problem statement says: "Vasya and Petya want to divide all pieces of pizza into two continuous sectors in such way that the difference between angles of these sectors is minimal." The keyword "continuous" is actually written in italic letters to point this out.