Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: bossc

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

Language: cpp

Time: 0.009 second

Submitted On: 2026-05-05 13:55:44

#include <bits/stdc++.h>
using namespace std;
int main() {
    int r,c;
    int x,y;
    int k;
    int neg = 0;
    int pos = 0;
    int odd = 0;
    int even = 0;
    cin >> r >> c;
    int arr[r][c];
    for (int i = 0;i<r;i++) {
        for (int j = 0;j<c;j++) {
            cin >> arr[i][j];
        }
    }
    cin >> k;
    for (int i = 0;i<k;i++) {
        cin >> x >> y;
        x--;
        y--;
        if (x >= 0 and y >= 0 and x < r and y < c) {
            if (arr[x][y] > 0) {
                pos++;
            }
            else if (arr[x][y] < 0) {
                neg++;
            }
            if (arr[x][y] % 2 == 0) {
                even++;
            }
            else if (arr[x][y] % 2 != 0) {
                odd++;
            }
        }
    }
    cout << pos << " " << neg << " " << even << " " << odd;
}