/*每个点自己建立一座发电站相当于向超级源点连一条长度为c[i]的边,连电线即为(k[i]+k[j])*两点间曼哈顿距离,跑最小生成树(prim适用于稠密图,kruscal适用于稀疏图)*/

#define HAVE_STRUCT_TIMESPEC
#include<bits/stdc++.h>
using namespace std;
int fa[2007];
int x[2007],y[2007];
int c[2007],k[2007];
long long m[2007][2007];
vector<pair<long long,pair<int,int> > >edge;
vector<int>ans_point;
vector<pair<int,int> >ans_edge;
int fi(int x){
return fa[x]==x?x:fa[x]=fi(fa[x]);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin>>n;
for(int i=1;i<=n;++i)
cin>>x[i]>>y[i];
for(int i=1;i<=n;++i)
cin>>c[i];
for(int i=1;i<=n;++i)
cin>>k[i];
for(int i=1;i<=n;++i){
m[0][i]=c[i];
fa[i]=i;
edge.push_back({c[i],make_pair(0,i)});
}
for(int i=1;i<=n;++i){
for(int j=i+1;j<=n;++j){
long long tamp=1ll*(k[i]+k[j])*(abs(x[i]-x[j])+abs(y[i]-y[j]));
edge.push_back({tamp,make_pair(i,j)});
}
}
sort(edge.begin(),edge.end());
long long ans=0;
for(int i=0;i<edge.size();++i){
long long tamp=edge[i].first;
int x=edge[i].second.first;
int y=edge[i].second.second;
if(fi(x)==fi(y))
continue;
ans+=tamp;
if(!x)
ans_point.push_back(y);
else
ans_edge.push_back({x,y});
fa[fi(y)]=x;
}
cout<<ans<<"\n";
cout<<ans_point.size()<<"\n";
for(int i=0;i<ans_point.size();++i)
cout<<ans_point[i]<<" ";
cout<<"\n";
cout<<ans_edge.size()<<"\n";
for(int i=0;i<ans_edge.size();++i)
cout<<ans_edge[i].first<<" "<<ans_edge[i].second<<"\n";
return 0;
}

05-27 05:17