My issue
It just says Runtime Error, without giving any indication whatsoever what the Runtime error happens to be.
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
int N;
int Q;
bool isNegative;
bool isZero;
int a[ 20000 ];
int x;
cin >> N >> Q;
for( int i = 0; i < N; i++ )
{
cin >> a[ i ];
}
for( int i = 0; i < Q; i++ )
{
cin >> x;
isNegative = isZero = false;
for( int j = 0; j < N; j++ )
{
if( x == a[ j ] )
{
cout << 0 << endl;
isZero = true;
break;
}
if( x < a[ j ] )
{
isNegative = !isNegative;
}
}
if( !isZero )
{
cout << ( isNegative? "NEGATIVE": "POSITIVE" ) << endl;
}
}
return 0;
}
Learning course: Binary Search
Problem Link: CodeChef: Practical coding for everyone