Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: jackpapho

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

Language: cpp

Time: 0.008 second

Submitted On: 2026-10-01 13:13:02

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    int arr[310][310],ans[4] = {};
    int row,col,n;
    cin >> row >> col;
    for (int i = 1;i <= row;i++){
        for (int j = 1;j <= col;j++){
            cin >> arr[i][j];
        }
    }
    cin >> n;
    for (int i = 0;i < n;i++){
        int x,y;
        cin >> x >> y;
        if (x <= 0||y <= 0||x > row||y>col) continue;
        if (arr[x][y] > 0) ans[0]++;
        if (arr[x][y] < 0) ans[1]++;
        if (arr[x][y] % 2 == 0) ans[2]++;
        if (arr[x][y] % 2 != 0) ans[3]++;
    }
    cout << ans[0] << " " << ans[1] << " "  << ans[2] << " " << ans[3];
    return 0;
}