kofhearts's blog

By kofhearts, history, 9 years ago, In English

I am very confused by this problem, especially with the third test case.

http://codeforces.me/contest/127/problem/C

It says the answer is

76 54

I am wondering why isn't the answer

114 81

Both gives the same final temperature

(143*114 + 81 * 456)/(114 + 81)

273.015384615

(143 * 76 + 456 * 54) / (76 + 54)

273.015384615

Since the temperature is same i thought that the higher values for y1 and y2 should be chosen since that will fill up faster. So, i thought 114 and 81 should be the optimal answer. Please help with this dilemma. I appreciate it!!

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

In this case x1 = 110 then y1 can't be 114 since y1 <= x1.

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

Print two space-separated integers y1 and y2 (0 ≤ y1 ≤ x1, 0 ≤ y2 ≤ x2)

You output y1 = 114, but 114 > 110 = x1.
You should divide y1 and y2 on gcd(y1, y2)

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

@Elise and @alexyz

114 < 117

if you read carefully

y1 flows through first tap and first tap is hot water top.

Hot water tap can transmit from 0 to x2 water units per second

in the test case

x2 is 117.

so is there still my misunderstanding or is the test case wrong? Thanks!

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

    The statement is a little misleading. It actually never explicitly says that the hot water tap is the first, it just says that there are two taps and name the hot before the cold but that doesn't mean there is an order between them.

    Furthermore, judging by the equation and numbers associated with t and x I think you can safely assume that the first tap is cold water tap.