Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: colo39

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-01 14:17:33

#include <bits/stdc++.h>
using namespace std;
int arr[400][400];
int a,b,c,d;
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n,m;
    cin >> n >> m;
    for (int i = 1;i <= n;i++) {
        for (int j =1;j <= m;j++) {
            cin >> arr[i][j];
        }
    }
    int q;
    cin >> q;
    // มีจ ำนวนเลขบวก จ ำนวนเลขติดลบ จ ำนวนคู่ และ จ ำนวนค
    
    while (q--) {
        int x,y;
        cin >> x >> y;
        if (x < 1 || x > n || y < 1 || y > m) continue;
        int num = arr[x][y];
        if (num > 0)a++;
        if (num < 0)b++;
        if (num % 2 == 0) c++;
        else d++;
    }
    cout << a << " " << b << " " << c << " " << d;
}