Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: mungkyskibidi

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

Language: cpp

Time: 0.009 second

Submitted On: 2026-04-25 13:14:14

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

int arr[300][300];

int main(){
	int r , c , k , pos = 0 , neg = 0 , even = 0 , odd = 0;
	cin >> r >> c;
	
	for(int i=1;i<=r;i++){
		for(int j=1;j<=c;j++) cin >> arr[i][j];
	}
	
	cin >> k;
	
	for(int i=0;i<k;i++){
		int a , b;
		cin >> a >> b;
		if(a > 0 && b > 0 && a <= r && b <= c) {
			if(arr[a][b] > 0) pos++;
			else if(arr[a][b] < 0) neg++;
			if(arr[a][b] % 2 == 0) even++;
			else odd++;
		}
		else{
			continue;
		}
	}
	
	cout << pos << " " << neg << " " << even << " " << odd;
}