Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: NovemNotes
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.005 second
Submitted On: 2025-10-15 13:27:14
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
int n,m;cin >> n >> m;
vector<vector<int>> v(n+1,vector<int>(m+1,0));
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin >> v[i][j];
}
}
int a,b,c,d;
a=b=c=d=0;
int q;cin >> q;
while(q--){
int x,y;cin >> x >> y;
if(x<1||x>n||y<1||y>m)continue;
if(v[x][y]>0)a++;
else if(v[x][y]<0)b++;
if(v[x][y]&1)d++;
else c++;
}
cout << a << " " << b << " " << c << " " << d << "\n";
return 0;
}