Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Kidmaiok

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

Language: cpp

Time: 0.008 second

Submitted On: 2026-10-11 20:34:51

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define space << ' '
#define nl << endl
int arr[300][300];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b;
    cin >> a >> b;
    for(int i =0; i < a; i++){
        for(int j =0; j < b; j++){
            int x;
            cin >> x;
            arr[i][j] = x;
        }
    }
    int num,pos=0,neg=0,even=0,odd=0;
    cin >> num;
    for(int i =0; i < num;i++){
        int x,y;
        cin >> x >> y;
        if((x < 1 || x > a) || (y < 1|| y > b)) continue;
        if(arr[x-1][y-1] % 2 == 0) even++;
        if(arr[x-1][y-1] % 2 != 0) odd++;
        if(arr[x-1][y-1] > 0) pos++;
        if(arr[x-1][y-1] < 0) neg++;
    }
    cout << pos  space << neg  space << even  space << odd;
}