Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: ZanTy

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

Language: cpp

Time: 0.007 second

Submitted On: 2026-10-04 12:38:10

#include <bits/stdc++.h>

int arr[305][305];
int a,b,c,d;
int main(){
    int n,m;
    std::cin.tie(nullptr);
    scanf("%d %d",&n,&m);
    for (int i = 0;i < n;i++){
        for (int j = 0;j < m;j++){
            scanf("%d",&arr[i][j]);
        }
    }
    int q,x,y;
    scanf("%d",&q);
    for (int i = 1;i <= q;i++){
        scanf("%d %d",&x,&y);
        x--;
        y--;
        if (x >= n || y >= m || x < 0 || y < 0){
            continue;
        }
        if (arr[x][y] < 0){
            b++;
        }
        if (arr[x][y] > 0){
            a++;
        }
        if (abs(arr[x][y]) % 2){
            d++;
        }
        else {
            c++;
        }
    }
    printf("%d %d %d %d",a,b,c,d);
}