裸题
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<iostream>
#include<algorithm>
#define T 1010
using namespace std;
int sc()
{
int i=0,f=1; char c=getchar();
while(c>'9'||c<'0'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9')i=i*10+c-'0',c=getchar();
return i*f;
}
struct E{int x,y;double d;}e[T*T];
int x[T],y[T],L[T],fa[T],mx;
int m,n,tot=0,sum=0,ans;
bool cmp(E a,E b){return a.d<b.d;}
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int main()
{
m=sc();
for(int i=1;i<=m;i++)L[i]=sc();
n=sc();
for(int i=1;i<=n;i++)
{
x[i]=sc(),y[i]=sc();
for(int j=1;j<i;j++)
{
e[++tot].x=j;
e[tot].y=i;
e[tot].d=sqrt((double)(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
}
fa[i]=i;
}
sort(e+1,e+tot+1,cmp);
for(int i=1;i<=tot;i++)
{
int p=find(e[i].x),q=find(e[i].y);
if(p!=q)
{
sum++;
fa[p]=q;
if(sum==n-1)mx=e[i].d;
}
}
for(int i=1;i<=m;i++) if((double)L[i]>=mx)ans++;
cout << ans;
return 0;
}