Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: nemuchannnUwU

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

Language: cpp

Time: 0.005 second

Submitted On: 2025-10-15 09:35:40

#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(nullptr)->sync_with_stdio(0);
	int n,m; cin >> n >> m;
	vector<vector<int>> v(n,vector<int> (m));
	for (int i=0;i<n;i++){
		for (int j=0;j<m;j++){
			cin >> v[i][j];
		}
	}
	int q;
	cin >> q;
	int pos=0;
	int neg=0;
	int ku=0;
	int ki=0;
	while(q--){
		int x,y;
		cin >> x >> y;
		if (x < 1 || x > n || y < 1 || y > m) continue;
		if (v[x-1][y-1]%2==0) ku++;
		else ki++;
		if (v[x-1][y-1]>0) pos++;
		else if(v[x-1][y-1]<0) neg++;
	}
	cout << pos << " " <<  neg << " " << ku << " " << ki;
}