Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: SpeedGai

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

Language: cpp

Time: 0.009 second

Submitted On: 2026-10-14 12:48:49

#include <bits/stdc++.h>
using namespace std;

int main() {
    int x, y, tidlob = 0, buak = 0, odd = 0, even = 0;
    cin >> x >> y;
    int mex[x + 1][y + 1];
    for(int i = 1; i <= x; i++){
    	for(int j = 1; j <= y; j++){
    		cin >> mex[i][j];	
		}
	}
	int n;
	cin >> n;

	for(int i = 0; i < n; i++){
		int r, c;
		cin >> r >> c;
		if(r > 0 && r <= x && c > 0 && c <= y){
			if(mex[r][c] % 2 == 0){even++;}
			if(mex[r][c] % 2 != 0){odd++;}
			if(mex[r][c] > 0){buak++;}
			if(mex[r][c] < 0){tidlob++;}
		}
	}
	cout << buak << " " << tidlob << " " << even << " " << odd;
	
}