Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Bestzu

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

Language: cpp

Time: 0.005 second

Submitted On: 2025-10-14 09:52:22

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    int r, c; cin >> r >> c;
    vector<vector<int>> a(r+1, vector<int>(c+1));
    for(int i = 1; i <= r; i++) {
        for(int j = 1; j <= c; j++) {
            cin >> a[i][j];
        }
    }

    int even = 0, odd = 0, pos = 0, neg = 0;
    int q; cin >> q;
    while(q--) {
        int i, j; cin >> i >> j;
		if(i > r || i < 1 || j > c || j < 1) continue;
		
        if(a[i][j] % 2 == 0) even++;
        else odd++;

        if(a[i][j] > 0) pos++;
        else if(a[i][j] < 0) neg++;
    }

    cout << pos << " " << neg << " " << even << " " << odd;
    return 0;
}