Best Carry Player
题号:NC255851
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Note that the context for the problem is simplified and may not be exactly the same as what is in-game. You may directly refer to the end of the problem statement for a formal definition of the problem.


Faceless Void is a melee carry hero in Dota 2, known for his ability to manipulate time to his advantage. 

Faceless Void, a Dota 2 hero

Faceless Void's first ability, Time Walk, allows him to teleport a short distance back in time, effectively undoing any damage taken during that period. This makes him a difficult target to take down, especially when combined with his high mobility and evasion. This ability has a cast range r_1, meaning that if we picture the Dota 2 map as a two-dimensional plane and Faceless Void is at position P, he can use this ability to teleport to any position Q such that \text{dist}(P,Q)\leq r_1, where \text{dist}(\cdot,\cdot) is the Euclidean distance between any two points on a two-dimensional plane.


Description of the ability: Time Walk.

Below we provide an in-game graphical illustration. In the following three pictures, Faceless Void is initially standing at some particular position, and he can use Time Walk to move to any position Q within distance r_1 of P (the range is shown by the green circle in the first picture).



Faceless Void's starting position P and cast range




Choose a point Q such that \text{dist}(P,Q)\leq r_1



Teleport to position Q.

Faceless Void's ultimate ability, Chronosphere, creates a bubble that freezes ALL units except himself within it in time. This ability is incredibly powerful in team fights, as it allows Void to isolate and take down important enemy heroes while his allies deal with the rest of the enemy team. This ability has a cast range r_2 and an area of effect R, meaning that if we picture the Dota 2 map as a two-dimensional plane and Faceless Void is at position P, he can use this ability to choose any position Q such that \text{dist}(P,Q)\leq r_2, and a circle centered at Q with radius R will be created, and all enemy/allied unit within it will be frozen.


Description of the ability: Chronosphere.



Below we provide an in-game graphical illustration. In the following three pictures, Faceless Void is initially standing at some particular position P, and he can cast Chronosphere at any position Q within distance r_2 of P (the range is shown by the green circle in the first picture), then a circle (a hemisphere in-game) centered at P with radius R will be created, freezing all other units inside the circle.


Faceless Void's starting position P and cast range




Choose a point Q such that \text{dist}(P,Q)\leq r_2


All other units inside the circle centered at Q with radius R will be frozen(with label STUNNED)

The interaction between Time Walk and Chronosphere allows Void to quickly reposition himself and initiate fights from unexpected angles. By using Time Walk to approach the enemy team, Void can then use Chronosphere to trap key enemy heroes and allow his team to follow up with their own spells and attacks. Overall, Faceless Void is a hero that requires good positioning, timing, and game sense to play effectively, but can be incredibly rewarding when played well. However, as Chronosphere traps both enemy heroes and ally heroes, you should be careful to cast the best Chronosphere!


Below we provide an in-game graphical illustration. In the following pictures, we give the positions of Faceless Void, his four teammates, and his five enemies. The teammates are the ones with leafy green health bars, the enemies are the ones with red health bars, and Faceless Void is the one with a light green health bar on the right side of the picture.



You and your enemies/your teammates' current positions


To set up a Time Walk-Chronosphere combo, Faceless Void might do as the two pictures illustrated below, freezing all his four allies and five enemies.


Use Time Walk to move to some position




Set up the chronosphere, freezing all enemies and allies

Or he could behave differently. The following two pictures illustrate another possibility, where Faceless Void could just freeze one ally, while still freezing all five enemies.


Use Time Walk to move to some other position




Set up the chronosphere, freezing all enemies and only one ally

In real-game situations, instead of simply labeling other units as enemies/allies, there are also priorities between other units. Sometimes you may want to freeze a single enemy rather than some other useless enemies, sometimes freezing/not freezing a unit makes nothing different, or sometimes you may even want to freeze your noob ally in case he does something stupid. Overall, all units are given a score a_i (which might be negative, positive, or equal to zero). Your goal is to set up a Time Walk-Chronosphere combo, such that the total score of all units frozen by Chronosphere is maximized. (This value could be zero or even negative, but who could blame you? You already did your best!)



In this problem, you are given the position of Faceless void and all n other units.and the scores of each of the n units. As the best carry player, you need to compute the maximum total score you can achieve through a Time Walk-Chronosphere combo.

Formally, you are given a two-dimensional point P=(x_0,y_0), representing the position of Faceless Void. You are also given the parameters r_1,r_2,R. You are given the information of n other units, where the i-th (1\leq i\leq n) other unit is at position Q_i=(x_i,y_i), with a score of a_i. Then your operation is formally described as.

1. Choose a two dimensional point X such that \text{dist}(P,X)\leq r_1, where X represents the position you Time Walk into.
2. Choose a two dimensional point Y such that \text{dist}(X,Y)\leq r_2, where Y represents the position where you cast Chronosphere.
3. Your score is defined as the sum of scores over the set of points in Q_1,Q_2,\dots,Q_n that is on or inside the circle with radius R, centered at Y.

You need to compute the maximum score you can achieve.


输入描述:

The first line contains six integers n,r_1,r_2,R,x_0,y_0 (1\leq n\leq 1000,1\leq r_1,r_2,R\leq 10^9,-10^9\leq x,y\leq 10^9), where n denotes the number of other units, r_1,r_2 and R are the three parameters, (x_0,y_0) denotes the initial position P of Faceless Void.

Then a line containing n integers a_1,a_2,\dots,a_n (-10^9\leq a_i\leq 10^9) follows, denoting the scores of each unit.

Then n lines follow. The i-th (1\leq i\leq n) line contains two integers x_i,y_i (-10^9\leq x_i,y_i\leq 10^9), denoting the position Q_i of the i-th unit. It is guaranteed that Q_i are pairwise distinct.

输出描述:

Output an integer in a line, denoting the maximum total score you can achieve through a Time Walk-Chronosphere combo. \textbf{It is guaranteed that the answer of the problem stays the same when R is replaced with any R' satisfying R-0.05\leq R'\leq R+0.05.}
示例1

输入

复制
1 1 1 1 0 0
1
2 2

输出

复制
1
示例2

输入

复制
4 100 100 100 0 0
-5 3 3 3
0 0
0 10
-10 -10
10 -10

输出

复制
6
示例3

输入

复制
4 100 100 100 0 0
-2 3 3 3
0 0
0 10
-10 -10
10 -10

输出

复制
7
示例4

输入

复制
4 10 10 10 14 14
1 1 1 1
7 7
7 -7
-7 7
-7 -7

输出

复制
4