Rotating Lines
시간 제한3초메모리 제한2048 MB
n개의 막대 각도가 정수 v[i] (0~49999)로 주어질 때, 여러 막대를 같은 각도로 동시에 회전시키되 전체 에너지 효율이 감소하지 않도록 하고 총 선택 횟수 2,000,000 예산 안에서 모든 쌍의 예각 합을 최대화합니다.
문제
Asadullo is an outstanding researcher at APIO (Alliance for Power and Industrial Optimization). Recently, he has been studying a method to generate energy using an unknown material.
This unknown material does not produce energy on its own, but if there are several extremely long rods made of this material, they can generate energy through their interactions.
Specifically, there are rods, given by an array . The -th rod can be positioned at an angle of , with respect to the positive direction of the x-axis, in counterclockwise. The energy efficiency by these rods is defined as where represents the acute angle formed between the -th rod and the -th rod. In this problem, we consider as an acute angle.
More formally, .
In other words, the energy efficiency is calculated by adding the acute angles between every pair of rods.For example, if and correspondingly, , we would get the following graph:

Here, (i.e. ), (i.e. ), and (i.e. ). Therefore, the energy efficiency of these rods equals .
Asadullo wants to adjust the arrangement of these n rods to maximize their energy efficiency. However, there are several constraints:
- First, since this material is extremely hazardous to living beings, the rods can only be rotated using a specialized mechanical device in a controlled manner. This device allows selecting multiple rods at once and rotating them by the same angle simultaneously.
- Asadullo does not want the energy efficiency of the rods to decrease. Therefore, after any operation using the device, the energy efficiency must not be lower than before.
- Since operating the device consumes a large amount of energy, the total number of rods selected across all operations must not exceed .
Under these constraints, Asadullo wants to perform operations optimally to maximize the energy efficiency of the rods. Write a program to help Asadullo achieve the highest possible energy efficiency.
제한
- for each
- elements of are not necessarily distinct
예제
이 문제는 공개된 예제가 없습니다.