Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: code
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.010 second
Submitted On: 2026-04-11 17:42:00
#include <bits/stdc++.h>
using namespace std;
int main (){
int r,c;cin>>r>>c;
int arr[r][c]={0};
for (int i=0;i<r;i++){
for (int j=0;j<c;j++){
cin>>arr[i][j];
}
}
int k;cin>>k;
int pos=0,neg=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){
continue;
}else{
if (arr[x][y]>0){
pos++;
}else if (arr[x][y]<0){
neg++;
}if (arr[x][y]%2==0){
even++;
}else{
odd++;
}
}
}
cout<<pos<<" "<<neg<<" "<<even<<" "<<odd;
return 0;
}