Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: kinzap

Problemset: สำรวจอาเรย์ 1

Language: cpp

Time: 0.009 second

Submitted On: 2025-10-13 00:25:25

#include <iostream>
using namespace std;

int r,c,a,n,pos,neg,odd,eve,x,y;

int main(){
    cin >> r >>c ;
    int arr[r][c];
    for(int i =0;i<r;i++){
        for(int j =0;j<c;j++){
            cin  >> a;
            arr[i][j]=a;
        }
    }
    cin >> n;
    for(int i = 0;i<n;i++){
        cin >> x >> y;
        if(x-1 < 0 || y-1 < 0 || x-1 >= r || y-1 >= c)continue;
        //cout << "x " <<x<<" y "<<y <<" arr " <<arr[x-1][y-1] << endl;
        if(arr[x-1][y-1]>0)pos++;
        if(arr[x-1][y-1]<0)neg++;
        if(arr[x-1][y-1] %2==0)eve++;
        if(arr[x-1][y-1] %2== 1 || arr[x-1][y-1] %2== -1 )odd++;
    }
    cout << pos << " " << neg << " " << eve << " " << odd;

}