Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Nont_5214

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

Language: cpp

Time: 0.006 second

Submitted On: 2026-10-13 16:18:55

#include <iostream>
#include <vector>
using namespace std;

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

    int Row, Column;
    int amount_cor;
    int even = 0; int odd = 0; int positive = 0; int negative = 0;
    cin >> Row >> Column;

    vector<vector<int>> matrix (Row, vector<int>(Column));
    for (int i = 0; i < Row; i++){
        for (int j = 0; j < Column; j++){
            int number; cin >> number;
            matrix[i][j] = number;
        }
    }
    cin >> amount_cor;
    vector<vector<int>> cor (amount_cor, vector<int>(2, 0));
    for(int i = 0; i < amount_cor; i++){
        for (int j = 0; j < 2; j++){
            int number; cin >> number;
            cor[i][j] = number;
        }
    }
    for(const auto& row : cor){
        int x = row.front() - 1;
        int y = row.back() - 1;
        if (((x >= 0) && (x < Row)) && ((y >= 0) && (y < Column))){
            int traget = matrix[x][y];
            if (traget != 0){
                if (traget > 0) {
                    positive++;
                }else{
                    negative++;
                }
            }if (abs(traget) % 2 == 0){
                even++;
            }else{
                odd++;
            }
        }
    }
    cout << positive << " " << negative << " " << even << " " << odd;
    return 0;
}