#include using namespace std; struct cloud { int loc; int range; }; struct home { int loc; int pop; int flag; }; bool compare1(struct home h1,struct home h2) { return (h1.loc < h2.loc); } bool compare2(struct cloud h1,struct cloud h2) { return (h1.loc < h2.loc); } int main() { int n; cin>>n; int i,j; struct home h[1000]; for(i=0;i>h[i].pop; for(i=0;i>h[i].loc; int m; cin>>m; struct cloud c[1000]; for(i=0;i>c[i].loc; int r[1000]; for(i=0;i>c[i].range; sort(h,h+n,compare1); sort(c,c+m,compare2); int sunpop=0,max=-1000; for(i=0;i= c[i].loc-c[i].range && h[j].loc <= c[i].loc+c[i].range){ if(h[j].pop > max){ max=h[j].pop; } h[j].flag=1; } } } for(i=0;i