Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: chillxvtkz

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

Language: cpp

Time: 0.007 second

Submitted On: 2026-10-09 10:27:15

#include <bits/stdc++.h>
#define ll long long
#define ct cout << ' '
#define el cout << endl;
using namespace std;
const int mx = 1e9;
const int mn = -1e9;


ll arr[305][305],R,C,t,ch,x=-1,y=-1,bb=0,rr=0,eve=0,od=0,w,d;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> R >> C;
    for (int i = 1; i <= R; i++)
    {
        for (int j = 1; j <= C; j++)
        {
            cin >> t;
            arr[i][j] = t;
        }
        
    }
    cin >> ch;
    for (int i = 0; i < ch; i++)
    {
        cin >> w >> d;
        if(w<=R && w>=1 && d<=C && d>=1){
            x = w;y = d;
        }
        if (x == -1) continue;
        if(arr[x][y]>0) bb=bb+1;
        if(arr[x][y]<0) rr=rr+1;
        if(arr[x][y]%2==0) eve=eve+1;
        if(arr[x][y]%2!=0) od=od+1;
    }
    cout << bb << " " << rr << " " << eve << " " << od << "\n";
    
    
    return 0;
}