Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: IIIIIIIIIIII
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.011 second
Submitted On: 2026-10-15 22:49:33
#include <iostream>
#include <vector>
using namespace std;
int main(){
int n, m, k, x, y, a1=0, a2=0, a3=0, a4=0;
cin >> n >> m;
vector<vector<int>> arr(n,vector<int>(m));
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin >> arr[i][j];
}
}
cin >> k;
for(int i=0;i<k;i++){
cin >> x >> y;
if(x<1 || y<1 || x>n || y>m) continue;
if(arr[x-1][y-1]>0) a1++;
if(arr[x-1][y-1]<0) a2++;
if(arr[x-1][y-1]%2==0) a3++;
if(arr[x-1][y-1]%2!=0) a4++;
}
cout << a1 << " " << a2 << " " << a3 << " " << a4;
}