Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: samsenpisardmoo26

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

Language: cpp

Time: 0.009 second

Submitted On: 2026-10-07 13:20:31

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin >> n >> m;
    int arr[n][m];
    
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            cin >> arr[i][j];
        }
    }
    
    int l;
    cin >> l;
    int c[l][2];
    int pos=0, neg=0, even=0;
    
    int cnt=0;
    for(int i=0; i<l; i++)
    {
        cin >> c[i][0] >> c[i][1];
        
        if(c[i][0] >= 1 && c[i][0] <= n && c[i][1] >= 1 && c[i][1] <= m)
        {
            cnt++;
            if(arr[c[i][0]-1][c[i][1]-1] > 0) pos++;
            if(arr[c[i][0]-1][c[i][1]-1] < 0) neg++;
            if(arr[c[i][0]-1][c[i][1]-1]%2==0) even++;
        }
    }
    cout << pos << " " << neg << " " << even << " " << cnt-even;
}