Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: matcherbrainner
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.009 second
Submitted On: 2026-10-31 21:38:08
#include<bits/stdc++.h>
using namespace std;
int main(){
int R,C;
cin>>R>>C;
vector<vector<long long>>a(R,vector<long long>(C));
for(int i=0;i<R;i++){
for(int j=0;j<C;j++){
cin>>a[i][j];
}
}
int K;
cin>>K;
int pos=0,neg=0,even=0,odd=0;
for(int k=0;k<K;k++){
int r,c;
cin>>r>>c;
if(r>=1&&r<=R&&c>=1&&c<=C){
long long val=a[r-1][c-1];
if(val>0){
pos++;
}
else if(val<0){
neg++;
}
if((val/2)*2==val){
even++;
}
else{
odd++;
}
}
}
cout<<pos<<" "<<neg<<" "<<even<<" "<<odd<<" ";
}