Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: MoZkun

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

Language: cpp

Time: 0.009 second

Submitted On: 2025-09-30 09:23:31

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

int main() {
    int r, c;
    cin >> r >> c;

    int a[305][305];
    for (int i = 1; i <= r; i++) {
        for (int j = 1; j <= c; j++) {
            cin >> a[i][j];
        }
    }

    int k;
    cin >> k;

    int p = 0, n = 0, e = 0, o = 0;

    for (int i = 0; i < k; i++) {
        int x, y;
        cin >> x >> y;

        if (x >= 1 && x <= r && y >= 1 && y <= c) {
            int v = a[x][y];
            if (v > 0) p++;
            else if (v < 0) n++;

            if (v % 2 == 0) e++;
            else o++;
        }
    }

    cout << p << " " << n << " " << e << " " << o << endl;
    return 0;
}