Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: kakcode
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.005 second
Submitted On: 2025-12-03 23:32:50
/*
TASK:
LANG: C++
AUTHOR: ICE
*/
#include <bits/stdc++.h>
using ll = long long;
#define forr(i, a, n) for (int i = a; i < n; i++)
const ll inf = 10e9;
#define int ll
using namespace std;
using pii = pair<int,int>;
int arr[310][310];
int ans[4];
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,m;
cin >> n >> m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++)cin >> arr[i][j];
}
int q;
cin >> q;
for(int i=0;i<q;i++){
int y,x;
cin >> y >> x;
y--;x--;
if(y >= n || x >= m || y < 0 || x < 0)continue;
if(arr[y][x] > 0)ans[0]++;
if(arr[y][x] < 0)ans[1]++;
if(abs(arr[y][x]) % 2 == 0)ans[2]++;
else ans[3]++;
}
for(int i=0;i<4;i++)cout << ans[i] << ' ';
return 0;
}