Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: SXLENG.S

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

Language: cpp

Time: 0.009 second

Submitted On: 2026-04-11 17:14:09

#include<iostream>

using namespace std;

int main(){
	int r,c,k;
	cin >> r >> c;
	
	int a[300][300];
	
	for ( int i=0;i<r;i++ ){
		for ( int j=0;j<c;j++ ){
			cin >> a[i][j];
		}
	}
	
	cin >> k;
	
	int p=0,n=0,even=0,odd=0;
	
	for ( int i=0;i<k;i++ ){
		int x,y;
		cin >> x >> y;
		x--;
		y--;
		
		if ( x>=0 && x<r && y>=0 && y<c ){
			if ( a[x][y] > 0 ){
				p++;
			}
			else if ( a[x][y] < 0 ){
				n++;
			}
			
			if ( ( a[x][y]%2 ) == 0 ){
				even++;
			}
			else odd++;
		}
		
	}
	
	cout << p << " " << n << " " << even << " " << odd;
	
}