Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: mumumimi
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.011 second
Submitted On: 2026-10-05 10:10:26
#include <bits/stdc++.h>
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 plus=0,lob=0,koo=0,kee=0;
for(int i=0;i<k;i++){
int a,b;
cin >> a >>b;
if(a < 1 || a > r || b < 1 || b > c){
continue;
}
if(arr[a-1][b-1]!=0){
if(arr[a-1][b-1]>0){
plus++;
}else{
lob++;
}
if(arr[a-1][b-1]%2==0){
koo++;
}else{
kee++;
}
}else{
koo++;
}
}
cout << plus << " " << lob << " " <<koo << " " << kee;
}