G - Easy Glide
import java.io.*;
import java.util.*;
public class Main
{
static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out = new PrintWriter(System.out);
static int inn() throws IOException
{
st.nextToken();
return (int) st.nval;
}
static double idd() throws IOException
{
st.nextToken();
return st.nval;
}
static int n=0;
static int m=0;
static int N=15000000;
static int h[]=new int[N];
static int ne[]=new int[N];
static int e[]=new int[N];
static double w[]=new double[N];
static boolean vis[]=new boolean[N];
static double d[]=new double[N];
static int idx=0;
static double inf=Long.MAX_VALUE;
static int bx;
static int fx;
public static void main(String[] args) throws IOException
{
Scanner s = new Scanner(System.in);
int n=s.nextInt();
num num[]=new num[n+3];
for(int i=2;i<=n+1;i++)
num[i]=new num(s.nextDouble(),s.nextDouble());
num[1]=new num(s.nextDouble(),s.nextDouble());
num[n+2]=new num(s.nextDouble(),s.nextDouble());
bx=s.nextInt();
fx=s.nextInt();
Arrays.fill(h,-1);
for(int i=2;i<=n+1;i++)
for(int j=1;j<=n+2;j++)
if(i!=j)
add(i,j,js(num[i],num[j]));
for(int i=2;i<=n+2;i++)
add(1,i,js2(num[1],num[i]));
dijkstra();
System.out.printf("%.8f",d[n+2]);
System.out.println();
}
static double js(num a,num b)
{
double jl=Math.sqrt(Math.pow(a.x-b.x, 2)+Math.pow(a.y-b.y, 2));
if(jl<=fx*3)
return jl/fx;
else
return 3+(jl-fx*3)/bx;
}
static double js2(num a,num b)//起点的花费的时间
{
double jl=Math.sqrt(Math.pow(a.x-b.x, 2)+Math.pow(a.y-b.y, 2));
return jl/bx;
}
static void dijkstra()
{
PriorityQueueheap=new PriorityQueue();
Arrays.fill(d,inf);
d[1]=0;
heap.add(new PII(1,0));
while(!heap.isEmpty())
{
PII t=heap.poll();
if(vis[t.id]==true)continue;
vis[t.id]=true;
for(int i=h[t.id];i!=-1;i=ne[i])
{
int j=e[i];
if(d[j]>t.cd+w[i])
{
d[j]=t.cd+w[i];
heap.add(new PII(j,d[j]));
}
}
}
}
static void add(int a,int b,double z)
{
e[idx]=b;
w[idx]=z;
ne[idx]=h[a];
h[a]=idx++;
}
}
class PII implements Comparable
{
int id;
double cd;
public PII(int id,double cd)
{
this.id=id;
this.cd=cd;
}
public int compareTo(PII other)//按照从小到大排序
{
if(this.cd>other.cd)
{
return 1;
}if(this.cd
L - Candy Machine
import java.io.*;
import java.util.*;
public class Main
{
static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out = new PrintWriter(System.out);
static int inn() throws IOException
{
st.nextToken();
return (int) st.nval;
}
static double idd() throws IOException
{
st.nextToken();
return st.nval;
}
public static void main(String[] args) throws IOException
{
Scanner s = new Scanner(System.in);
int n=inn();
double a[]=new double[n];
double sum=0;
double avg=0;
for(int i=0;i>1;
while(l>1;
if(a[mid]>key)r=mid;
else
l=mid+1;
}
return r;
}
}
M - BpbBppbpBB
import java.io.*;
import java.util.*;
public class Main
{
static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
static PrintWriter out = new PrintWriter(System.out);
static int inn() throws IOException
{
st.nextToken();
return (int) st.nval;
}
static double idd() throws IOException
{
st.nextToken();
return st.nval;
}
public static void main(String[] args) throws IOException
{
Scanner s = new Scanner(System.in);
int n=s.nextInt();
int m=s.nextInt();
char a[][]=new char[n+10][];
for(int i=0;i



