Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: FIrmTInn
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.008 second
Submitted On: 2025-10-12 00:00:36
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m,num,find_num,x,y,c_odd = 0,c_even =0,c_neg = 0,c_pos = 0;
cin >> n >> m;
int arr1[n][m] = {0};
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin >> arr1[i][j];
}
}
cin >> find_num;
for(int i=0;i<find_num;i++){
cin >> x >> y;
if(x <= 0 || x > n || y <= 0 || y > m){
continue;
}
if(arr1[x-1][y-1] % 2 == 0){
c_even++;
}
else if(arr1[x-1][y-1] % 2 != 0){
c_odd++;
}
if(arr1[x-1][y-1] > 0){
c_pos++;
}
else if(arr1[x-1][y-1] < 0){
c_neg++;
}
}
cout << c_pos << " " << c_neg << " " << c_even << " " << c_odd << "\n";
return 0;
}