Logo
(追記) (追記ここまで)

33344번 - Linear Gradient 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB31171144.000%

문제

There is a trapezoid with vertices $(x_1, y_1),ドル $(x_1, y_2),ドル $(x_2, y_3),ドル $(x_2, y_4)$ in the Euclidean plane that is painted with a linear gradient (defined below).

Let a triple of real numbers $(r, g, b)$ represent a color of a point, and let us use this to define three colors:

  • red: $r \geq 150,ドル $g \leq 75,ドル $b \leq 75$;
  • green: $g \geq 150,ドル $r \leq 75,ドル $b \leq 75$;
  • blue: $b \geq 150,ドル $r \leq 75,ドル $g \leq 75$.

The trapezoid is colored using a set of lines which collectively cover the entire area of the trapezoid and produce a color gradient. The set is defined as follows:

  • Each line in the set is defined by a value of $t$ ($t \in [0, 1]$).
  • The endpoints of the line are $(x_1, (1 - t) y_1 + t y_2)$ and $(x_2, (1 - t) y_3 + t y_4)$.
  • The color of the left endpoint is ($r_{\ell}, g_{\ell}, b_{\ell}$), and the color of the right endpoint is ($r_r, g_r, b_r$).
  • The color of an inner point on the line is determined by linear interpolation (see Note for definition) between the left and right colors, based on the distance from the left endpoint to that point.

Calculate the total area of the red, blue, and green parts of the trapezoid.

입력

The first line contains integers $x_1,ドル $y_1,ドル $y_2,ドル $r_{\ell},ドル $g_{\ell},ドル $b_{\ell}$.

The second line contains integers $x_2,ドル $y_3,ドル $y_4,ドル $r_r,ドル $g_r,ドル $b_r$.

출력

Output three real numbers: the red area, the blue area, and the green area, respectively. The absolute or relative error should not exceed 10ドル^{-9}$.

제한

  • 0ドル \leq x_1 < x_2 \leq 100,000円$;
  • 0ドル \leq y_1 < y_2 \leq 100,000円$;
  • 0ドル \leq y_3 < y_4 \leq 100,000円$;
  • 0ドル \leq r_{\ell}, g_{\ell}, b_{\ell}, r_r, g_r, b_r \leq 255$.

예제 입력 1

0 0 50 255 0 0
100 0 100 0 255 0

예제 출력 1

1686.851211072
2724.913494800
0.000000000

노트

Linear interpolation is a method of estimating values within an interval, based on known values at the endpoints. In the context of color interpolation, it means that the color components $(r, g, b)$ are calculated as a weighted average of the corresponding components of the left and right colors, with the weights determined by the relative distance of the point from the left endpoint and the right endpoint. This creates a smooth transition of colors along the line.

출처

Camp > Petrozavodsk Programming Camp > Summer 2023 > Day 2: Nyatl Contest 2023 L번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /