Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Tjeez
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.010 second
Submitted On: 2026-10-09 00:12:15
#include <iostream>
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 p=0,n=0,e=0,o=0;
for (int i=0 ; i<k ; i++){
int x,y; cin>>x>>y;
if (x>=1 && x<=r && y>=1 && y<=c){
x--;y--;
if (arr[x][y]%2==0)e++;
else o++;
if (arr[x][y]>0) p++;
else if(arr[x][y]<0) n++;
}
}
cout<<p<<" "<<n<<" "<<e<<" "<<o;
}
/*4 6 0 -1 2 3 -3 -7 11 7 -4 12 17 -6 -7 12 11 -9 -1 0 0 -2 8 10 -5 8 10 4 2 1 1-3 2 2 0 3 4 2 6 1 4 4 5 3 7 5 2 */