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

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

Hey I was recently giving a coding test for a company and this question appeared.

You are given points (0,0) (N,0) (0,M) and (N,M) that form a rectangle. You have a point (x,y) that is within a rectangle or on one of its edges. Now a straight line is drawn passing through (x,y) to cut the rectangle into 2 parts. Find the max possible area of the part whose area is not larger than the other. Also determine if there are multiple ways to cut the rectangle and achieve the maximum.

Input: N M X Y

1<= N,M<= 1E9

0<=X<=N

0<=Y<=M

Output: Print the max possible area followed by 1 if there are multiple ways to cut the rectangle and achieve maximum else print 0

Sample cases:

2 3 1 2

3.00000 0

the line x=1 gives the optimal cut with no other posibilties.

2 4 1 2

4.000000 1

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

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

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

Someone please take a look at the above editorial i could not understand the editorial, so please write a detailed answer. (https://atcoder.jp/contests/abc194/tasks/abc194_f)

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

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