#include <bits/stdc++.h>   using namespace std;   int n, m;   int pos, neg, tmp, x, y, len;   int main() {     scanf( %d%d , &n, &m);     pos = 0;     neg = 0;     for (int i = 0; i < n; ++i) {       scanf( %d , &tmp);       if (tmp > 0)         ++pos;       else         ++neg;     }     while (m--) {       scanf( %d%d , &x, &y);       len = y - x + 1;       if (len & 1)         printf( 0 n );       else {         if (len / 2 <= min(pos, neg))           printf( 1 n );         else           printf( 0 n );       }     }     return 0;   }   