Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: Songkran

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

Language: cpp

Time: 0.010 second

Submitted On: 2025-09-27 22:14:57

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

int main(){
    int m,n,find,plus = 0,minus = 0,even = 0,odd =0;
    cin >> m >>n;
    int arr[m][n];
    for (int i = 0; i < m; i++){
        for (int j = 0; j < n; j++){
            cin >> arr[i][j];
        }
    }
    cin >> find;
    int it[find], jt[find];
    for (int x = 0; x < find; x++){
        cin >> it[x] >> jt[x];
        int row = it[x] - 1;
        int col = jt[x] - 1;
        if (row < 0 || row >= m || col < 0 || col >= n){
            continue;
        }
        if (arr[row][col] > 0) plus++;
        if (arr[row][col] < 0) minus++;
        if (arr[row][col] % 2 == 0) even++;
        else odd++;
    }

    cout << plus << " " << minus << " " << even << " " << odd;
    return 0;
}