Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: tl.cpp
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.005 second
Submitted On: 2026-08-03 14:41:59
#include <bits/stdc++.h>
using namespace std;
const int N = 310;
int n, m, k, a[N][N];
int ps, ms, od, en;
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) cin >> a[i][j];
}
cin >> k;
while (k--) {
int x, y;
cin >> x >> y;
if (x < 1 || x > n) continue;
if (y < 1 || y > m) continue;
int d = a[x][y];
if (d > 0) ps++;
if (d < 0) ms++;
if (d % 2) od++;
else en++;
}
cout << ps << ' ' << ms << ' ' << en << ' ' << od;
}