Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: shurye

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

Language: cpp

Time: 0.009 second

Submitted On: 2026-10-12 20:50:51

#include <iostream>
using namespace std ;
int r,c,N,Positive,Negative,Even,Odd;
int main(){
    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 >> N;
    for(int i = 0; i < N;i++){
        int R,C;
        cin >> R >> C;
        if(!(R <= 0 || R>r || C >c || C <= 0)){
            R--; C-- ;
            if(arr[R][C] < 0){
                Negative ++;
            }else if(arr[R][C] > 0){
                Positive++;
            }
            if(arr[R][C] %2 == 0){
                Even++;
            }else {
                Odd++;
            }
        }
    }cout << Positive<< " "<<Negative<< " "<< Even << " "<< Odd;
}