Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Fadil

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

Language: cpp

Time: 0.010 second

Submitted On: 2026-10-05 11:05:58

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n1,n2;
    cin >> n1 >> n2;
    int arr[n1][n2];
    for(int i=0;i<n1;i++){
        for(int j=0;j<n2;j++){
            cin >> arr[i][j];
        }
    }int cnt1 = 0,cnt2 = 0,cnt3 = 0,cnt4 = 0;
    int n3;
    cin >> n3;
    for(int i=0;i<n3;i++){
        int a,b;
        cin >> a >> b;
        a -= 1;
        b -= 1;
        if(a >= 0 && a <= n1 - 1 && b >= 0 && b <= n2 - 1){
            if(arr[a][b] > 0){
                cnt1++;
            }else if(arr[a][b] < 0){
                cnt2++;
            }if(arr[a][b]%2 == 0){
                cnt3++;
            }else{
                cnt4++;
            }
        }
    }cout << cnt1 << " " << cnt2 << " " << cnt3 << " " << cnt4;
}