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