private static bool Dswap(int[] a, int i, int j, int d) {
bool r = false;
if (i == j) return true;
if (a[i] >= j - d && a[i] <= j + d &&
a[j] >= i - d && a[j] <= i + d) {
r = true;
int t = a[i];
a[i] = a[j];
a[j] = t;
//if (a[i] == i) throw new Exception("Was here!");
//if (a[j] == j) throw new Exception("Was here!");
}
return r;
}