Submission

Status:

PPPPPP-PPP

Subtask/Task Score:

90/100

Score: 90

User: mik

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

Language: cpp

Time: 0.010 second

Submitted On: 2026-10-11 09:44:10

#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    int r,c;
    cin >> r >> c;
    vector<vector<int>> ar(r,vector<int>(c));
    for (int i=0;i<r;i++){
        for (int j=0;j<c;j++){
            cin >> ar[i][j];
        }
    }
    int n,x,y,q=0;
    int p=0,l=0,e=0,o=0;
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> x >> y;
        if (x >= 1 && x <= r && y >= 1 && y <= c) {
            q = ar[x - 1][y - 1];
        }
        if (q>0) p++;
        if (q<0) l++;
        if (q%2==0) e++;
        else o++;
    }
    cout << p << ' ' << l << ' ' << e << ' ' << o;
    return 0;
}