Submission

Status:

--------xx

Subtask/Task Score:

0/100

Score: 0

User: Alif_Sama

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

Language: cpp

Time: 0.009 second

Submitted On: 2025-10-07 21:02:55

#include <iostream>
using namespace std;

int main() {
    int n,m;
    cin >> n >> m;
    int arr[n][m] = {0};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> arr[i][j];
        }
    }
    //just print array debug test heh
    // for (int i = 0; i < n; i++) {
    //     for (int j = 0; j < m; j++) {
    //         cout << arr[i][j] << " ";
    //     }
    //     cout << "\n";
    // }
    int s;
    cin >> s;
    int minus = 0,plus = 0,even = 0,odd = 0;
    for (int i = 0; i < s; i++) {
        int a,b;
        cin >> a >> b;
        if (arr[a-1][b-1]) {
            int num = arr[a-1][b-1];
            if (num == 0) {
                even++;
                continue;
            } else if (num < 0) {
                minus++;
            } else if (num > 0) {
                plus++;
            }
            if (num % 2 == 0) {
                even++;
            } else {
                odd++;
            }
        }
    }
    printf("%d %d %d %d", plus,minus,even,odd);
}