Submission

Status:
PPPPPPPPPP

Score: 100

User: Namkhing

Problemset: สำรวจอาเรย์ 1

Language: cpp

Time: 0.005 second

Submitted On: 2025-04-11 15:15:01

#include <bits/stdc++.h>
using namespace std;

const int N = 310;
int n, m, q, a[N][N];
int ans[4];

int main() {
    cin.tie(nullptr)->ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> a[i][j];
    cin >> q;
    while (q--) {
        int x, y;
        cin >> x >> y;
        if (x < 1 || x > n || y < 1 || y > m) continue;
        int val = a[x][y];
        if (val > 0) ans[0]++;
        if (val < 0) ans[1]++;
        if (val % 2 == 0) ans[2]++;
        else ans[3]++;
    }
    for (int i = 0; i < 4; i++) cout << ans[i] << " ";
}