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

3137번 - DORUCAK 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB184321.429%

문제

Mirko and Slavko like to eat burek for breakfast. This one time they bought one with cheese and another with meat. Watching the hot bureks on the table, teasing their nostrils with enticing aromas, they could not decide on who would get which burek so they decided to split both of them in halves. Mirko boasted that he could cut both bureks in two halves of equal areas with just one swift stroke of his knife. Help Mirko accomplish this before the bureks get cold.

Image corresponds to first example.

Each of the bureks is a convex polygon. The bureks are positioned so that one of them is completely left of the y-axis, and the other completely right of it.

Write a program that, given the coordinated of the polygons, calculates the equation of the line that splits both bureks into two halves of equal areas.

입력

The first line contains an integer N (3 ≤ N ≤ 5000), the number of vertices in the first burek.

Each of the following N lines contains two real numbers X and Y in decimal format (−1000 < X < 0, −1000 < Y < 1000), the coordinates of one vertex in the burek.

The remainder of the input describes the second burek in the same format.

In both bureks, the vertices will be given in counter-clockwise order. The coordinates of the vertices will be given with exactly three digits after the decimal point. No three points in a polygon will be collinear.

출력

Output two numbers A and B so that y = A ⋅ x + B describes a line for Mirko to use to cut the bureks. Your output must be accurate to ±0.001.

Note: the solution always exists and is unique.

제한

예제 입력 1

3
-6.000 1.000
-2.000 2.000
-5.000 6.000
5
1.000 -1.000
3.000 -2.000
6.000 0.000
4.000 3.000
1.000 2.000

예제 출력 1

-0.319961 1.556489

예제 입력 2

4
-5.000 -1.000
-3.000 -1.000
-3.000 6.000
-5.000 6.000
4
3.222 2.000
5.000 1.000
5.000 4.000
3.222 3.000

예제 출력 2

0.000000 2.500000

힌트

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2008 > Final Exam #2 2번

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

출처

대학교 대회

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

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