#include #include #include #include #include #include #include typedef struct str { int value; int index; }str; int cmp(const void *a,const void *b) { struct str *a1 = (struct str *)a; struct str *a2 = (struct str*)b; if((*a1).value>(*a2).value)return -1; else if((*a1).value<(*a2).value)return 1; else return 0; } long int maximumPeople(int p_size, long int* p, int x_size, long int* x, int y_size, long int* y, int r_size, long int* r,str p2,str r2) { // Return the maximum number of people that will be in a sunny town after removing exactly one cloud. long int t=0; int abc=0; /* while(abc!=n){ //p[abc] if(p2[0].index==r2[0].index) } */ return t; } int main() { int n; //the number of towns. scanf("%i", &n); //the population of the town. long long int total=0; long int *p = malloc(sizeof(long int) * n); str p2[n];//long int *p2 = malloc(sizeof(long int) * n); for (int p_i = 0; p_i < n; p_i++) { scanf("%li",&p[p_i]); p2[p_i].value=p[p_i]; p2[p_i].index=p_i; total=total+p[p_i]; } qsort(p2,n,sizeof(p2[0]),cmp); //quickSort(p2, 0, p_i-1); //location of the town on the one-dimensional line. long int *x = malloc(sizeof(long int) * n); for (int x_i = 0; x_i < n; x_i++) { scanf("%li",&x[x_i]); } //enoting the number of clouds covering the city. int m; scanf("%i", &m); //hich denotes the location of the cloud on the coordinate axis. long int *y = malloc(sizeof(long int) * m); for (int y_i = 0; y_i < m; y_i++) { scanf("%li",&y[y_i]); } //ated integers denoting the range of the cloud. long int *r = malloc(sizeof(long int) * m); str r2[m];//long int *r2 = malloc(sizeof(long int) * m); for (int r_i = 0; r_i < m; r_i++) { scanf("%li",&r[r_i]); r2[r_i].value=r[r_i]; r2[r_i].index=r_i; } qsort(r2,m,sizeof(r2[0]),cmp); //quickSort(r2, 0, r_i-1); if((m==0)||(m==1)) printf("%lld\n",total); else{ long int result = maximumPeople(n, p, n, x, m, y, m, r,p2,r2); printf("%ld\n", result); } return 0; }