### Query over Matrix

#### Description:

" There is a N*N square matrix. You have been given N specifications, one per row of the matrix. The ith specifications is represented by a pair of integers L[i] and R[i], denoting that all element belonging to columns between L[i] and R[i] (both inclusive) in row i are 1, while the rest of the elements of the ith row are 0. Now you will be given an integer Q, followed by Q operations: Each query is described by two integers x and y, which asks what will be the parity of the sum of the matrix if the xth row and the yth column are removed from the matrix. Input First line of the input contains an integer N, followed by N lines: each containing a pair of integers. ith pair of integers denotes the value of L[i] and R[i]. The next line contains the value of Q, and the following Q lines contain the queries. Output Q lines, each containing a single character ""E"" or ""O"" (no quotes needed), indicating whether the sum is even or odd. " Test Case 1 Input (stdin) 3 1 3 2 2 1 3 2 2 2 3 2 Expected Output E E Test Case 2 Input (stdin) 3 1 3 2 1 1 2 2 2 2 3 2 Expected Output O E

#### Program :

#include<stdio.h>

long int arr;

int main()

{

long int n,i,j,sumx={0},sumy={0},q,x,y,temp1;

long long int sum=0;

scanf("%ld",&n);

for(i=1;i<=n;i++)

{

scanf("%ld %ld",&x,&y);

arr[i]=x;

arr[i]=y;

for(j=x;j<=y;j++)

{

sumx[i]++;

sumy[j]++;

sum++;

}

}

scanf("%ld",&q);

temp1=q;

for(i=0;i<temp1;i++)

{

scanf("%ld %ld",&x,&y);

long long int temp;

temp=sum;

temp=temp-(sumx[x]+sumy[y]);

if(arr[x]<=y && arr[x]>=y)

temp=temp+1;

if(temp%2==0)

printf("E\n");

else

printf("O\n");

}

return 0;

}