Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: ChanakanStudy

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-10-09 15:45:07

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
using namespace std;
using ll = long long;
int a[301][301];

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

    int n,m;
    cin >> n >> m;
    for(int i = 0;i<n;i++) {
        for(int j = 0;j<m;j++) {
            int temp;
            cin >> temp;
            a[i][j] = temp;
        }
    }
    int countplus = 0,countera = 0,counteven=0,countodd=0;
    int q;
    cin >> q;
    while(q--) {
        int x,y;
        cin >> x >> y;
        if((x <= n && y <= m) && (x > 0 && y > 0)) {
            x--;
            y--;
            if(a[x][y] >0) {
                countplus++;
            }
            if(a[x][y]< 0) {
                countera++;
            }
            if(a[x][y] %2 == 0) {
                counteven++;
            }
            else {
                countodd++;
            }
        }
    }
    cout << countplus << " " << countera << " " << counteven << " " << countodd;
    return 0;
}