Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: lingusso
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.009 second
Submitted On: 2026-03-25 12:39:45
#include<iostream>
#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 n,x,y;
int pos=0,neg=0,odd=0,even=0;
cin>>n;
for(int i=1;i<=n;i++){
cin>>x>>y;
if(x > r || y >c || x<=0 || y<=0){
continue;
}
if(arr[x-1][y-1] == 0){
}
else if(arr[x-1][y-1] > 0){
pos++;
}
else{
neg++;
}
if(arr[x-1][y-1] % 2 ==0){
even++;
}
else{
odd++;
}
}
cout<<pos<<" "<<neg<<" "<<even<<" "<<odd<<" ";
return 0;
}