Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Prap

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

Language: cpp

Time: 0.009 second

Submitted On: 2026-03-25 12:32:57

#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;
int main() {
	int R,C;
	cin>>R>>C;
	int arr[R][C];
	for (int i = 0; i<R; i++) {
		for (int j = 0; j<C; j++) {
			cin>>arr[i][j];
		}
	}
	int K;
	cin>>K;
	int aa,bb;
	int countodd = 0;
	int counteven = 0;
	int countpos = 0;
	int countnig = 0;
	for (int i = 0; i<K; i++) {
		cin>>aa>>bb;
		if (aa>0 && bb>0 && aa<=R && bb<=C) {
			if (arr[aa-1][bb-1] < 0) {
				countnig++;
			}
			if (arr[aa-1][bb-1] > 0) {
				countpos++;
			}
			if (arr[aa-1][bb-1] % 2 == 0) {
				counteven++;
			}
			if (arr[aa-1][bb-1] % 2 == 1 || arr[aa-1][bb-1] % 2 == -1) {
				countodd++;
			}
		}
	}
	cout<<countpos<<" "<<countnig<<" "<<counteven<<" "<<countodd;
	return 0;
	return 0;
}