Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: thitit

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

Language: cpp

Time: 0.006 second

Submitted On: 2026-10-05 22:44:27

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    cin.tie(0)->sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    vector<vector<int>> num(a,vector<int>(b));

    for (int i = 0; i < a; i++) {
        for (int j = 0; j < b; j++) {
            cin >> num[i][j];
        }
    }

    int how_many;
    cin >> how_many;
    int x;
    int y;
    int positive = 0;
    int negative = 0;
    int odd = 0;
    int even = 0;

    for (int i = 0; i < how_many; i++) {
        cin >> x;
        cin >> y;
        x--;
        y--;

        if (x >= 0 && y >= 0 && x < a && y < b) {
        if (num[x][y] > 0) {
            positive = positive + 1;
        }
        if (num[x][y] < 0) {
            negative = negative + 1;
        }
        if (num[x][y] % 2 == 0) {
            even = even + 1;
        }
        if(num[x][y] % 2 != 0){
            odd = odd + 1;
        }
            
        
    
        
        }
    }
    cout << positive << " " << negative << " " << even << " " << odd;
}