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

30946번 - Ball Passing 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB96555261.176%

문제

A group of students has just finished their math lesson and they're heading out for physical education. Their teacher has asked them to arrange themselves in a circle. After several minutes of busy moving around the court they have finally managed to position themselves so that they form a strictly convex polygon. They might not lie on the circle, but the teacher is happy to at least get some structure.

There is an even number of boys and an even number of girls in this group of $N$ students. They will practice ball passing in pairs, therefore the teacher has to pair them up. The teacher will pair boys among themselves and the same for girls.

The school administration has decided to address the decline in physical performance of their students. Therefore, they have implemented a quality measure for ball passing practice, which is the total distance traveled by the balls in a single round of ball passes between each pair. Help the teacher pair up the students in a way that will maximize this measure.

입력

The first line contains the number of students $N$. The second line contains a string $S$ of length $N,ドル which describes the students along the perimeter of the polygon with a character "B" for a boy and "G" for a girl. The following $N$ lines provide the locations of students with space-separated integer coordinates $X_i$ and $Y_i$ in the same order as they are described in the string $S$.

출력

Output the maximum ball passing distance that can be obtained by pairing up the students appropriately. The solution will be considered correct if the relative or absolute error compared to the official solution is within 10ドル^{-6}$.

제한

  • 2ドル \leq N \leq 50$
  • The number of boys and girls will both be even. Note that one of them can be zero.
  • The coordinates $X_i$ and $Y_i$ won't exceed 10ドル,000円$ by absolute value.

예제 입력 1

4
BGBG
0 0
0 1
1 1
1 0

예제 출력 1

2.828427125

예제 입력 2

4
GGBB
0 0
0 1
1 1
1 0

예제 출력 2

2

예제 입력 3

12
GBGBBGBBBBGB
0 -15
6 -14
19 -5
17 7
11 12
1 15
-9 13
-15 10
-17 8
-19 4
-16 -9
-13 -11

예제 출력 3

186.529031603

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2023 B번

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

출처

대학교 대회

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

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