Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Trin1506

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

Language: cpp

Time: 0.009 second

Submitted On: 2025-10-13 15:34:30

#include <bits/stdc++.h>
using namespace std;
int main() {
    int r,c;
    cin >> r >> c;
    int arr1[r][c];
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            cin >> arr1[i][j];
        }
    }
    int n;
    cin >>n;
    int c1,c2,pos=0,neg=0,even=0,odd=0;
    for(int i=0;i<n;i++){
        cin >> c1 >> c2;
        if(c1<=0||c2<=0)continue;
        if(c1>r||c2>c)continue;
        if(arr1[c1-1][c2-1]>0)pos++;
        else if(arr1[c1-1][c2-1]<0)neg++;
        if(arr1[c1-1][c2-1]%2==0)even++;
        else odd++;
    }
    cout << pos<<" "<<neg <<" "<< even <<" "<< odd ; 
}