void quickSort_ascend(int[] a, int[] b, int l, int r) {
if (l < r) {
int w = a[(l+r)/2];
int i = l, j = r, temp;
while (i < j) {
while (a[i] < w) i++;
while (a[j] > w) j--;
if (i <= j) {
temp = a[i];
a[i] = a[j]; a[j] = temp;
temp = b[i];
b[i] = b[j]; b[j] = temp;
i++; j--;
}
}
quickSort_ascend(a, b, l, j);
quickSort_ascend(a, b, i, r);
}
}
void quickSort_descend(int[] a, int[] b, int l, int r) {
if (l < r) {
int w = a[(l+r)/2];
int i = l, j = r, temp;
while (i < j) {
while (a[i] > w) i++;
while (a[j] < w) j--;
if (i <= j) {
temp = a[i];
a[i] = a[j]; a[j] = temp;
temp = b[i];
b[i] = b[j]; b[j] = temp;
i++; j--;
}
}
quickSort_descend(a, b, l, j);
quickSort_descend(a, b, i, r);
}
}