Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: UNJE0o

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

Language: cpp

Time: 0.012 second

Submitted On: 2026-10-11 11:24:48

#include<iostream>
#include<iomanip>
#include<ios>
#include<string>
#include<set>
#include<vector>
#include<cctype>
#include<algorithm>
#include<cmath>
#include<stdio.h>
using namespace std;
#define en '\n'

int main(){
    int ps = 0,ms = 0,od = 0,ve = 0,
        m,n,x,y,l;
    cin >> m >> n;

    int bx[m][n];
    for(int i = 0;i < m;i++){
        for(int j = 0;j < n;j++) cin >> bx[i][j];
    }
    cin >> l;
    for(int i = 0;i < l;i++){
        cin >> y >> x;
        if(y-1>= 0 && y-1 < m && x-1 >= 0 && x-1 < n){
            if(bx[y-1][x-1] > 0) ps += 1;
            if(bx[y-1][x-1] < 0) ms += 1;
            if(bx[y-1][x-1]%2 != 0) od += 1;
            if(bx[y-1][x-1]%2 == 0) ve += 1;
        }
    }

    printf("%d %d %d %d",ps,ms,ve,od);

}