#include #include using namespace std ; void printArray(int *array, int size){ for(int i = 0; i < size; i++){ cout << array[i] << " " ; } } bool is3DSonar1D(int *array, int *hash, int iter_id, int p, int n){ int *hash = NULL ; int p2 = p*p ; int dif ; for (int h1 = 0; h1 < p; h1++){ for(int h2 = 0; h2 < p; h2++){ if(h1 == 0 && h2 == 0) continue ; //printArray(hash, p2) ;cout << endl ; for(int i = 0; i < p; i++){ if(p*i > n-1) break ; for(int j = 0; j < p; j++){ if(i == 0 && j == 0) continue ; if((i+h1) % p == 0 && (j+h2) % p == 0) continue ; if(p*i+j > n-1) break; if( p * ((i + h1) % p) + ((j+h2) % p) > n - 1) continue ; dif = (array[ p *((i + h1) % p) + ((j+h2) % p)] - array[p*i+j]); //cout <= start){ counter++ ; sonar = false ; if(array[end] + 1 > n-1){ array[end] = -1; end-- ; continue ; } array[end]++; if(counter % 2000 == 0){ cout << "Check Point: " ; printArray(array, end+1); cout << endl; counter = 0; } if (is3DSonar1D(array, p, end+1)){ //cout <<"Costas";printArray(array, end+1) ; cout <