Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: dddrrrr

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

Language: cpp

Time: 0.005 second

Submitted On: 2025-10-15 14:00:58

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

int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n ,m;
	cin >> n>> m;
	int odd=0 ,even=0 ,pos=0 ,neg=0; 
	vector <vector <int>> vec(n ,vector <int>(m));
	for(auto &row : vec){
		for(auto &col : row){
			cin >> col;
		}
	}
	
	int q;cin >> q;
	while(q--){
		int x ,y;
		cin >> x >> y;
		x--;
		y--;
		
		if(x < 0 || y < 0 || x>= n || y >= m)continue;
		
		if(vec[x][y] > 0)pos++;
		else if(vec[x][y] < 0)neg++;
		
		if(vec[x][y] % 2 == 0)even++;
		else odd++;
		
	}
	
	cout << pos << ' ' << neg << ' ' << even << ' ' << odd;
	return 0;
	
}