Submission

Status:

--TT--TT--

Subtask/Task Score:

0/100

Score: 0

User: 666whynot

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

Language: cpp

Time: 1.085 second

Submitted On: 2025-09-03 16:21:39

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    int r,c;cin>>r>>c;
    int a[r][c];
    for(int i=1;i<=r;i++){
        for(int j=1;j<=c;j++){
            cin >> a[i][j];
        }
    }
    int plus=0,nega=0,even=0,odd=0;
    int k;cin>>k;
    while(k--){
        int x,y;cin>>x>>y;
        if(x <= 0 || y <= 0 || x >r || y > c)continue;
        if(a[x][y] == 0)even ++;
        else if(a[x][y] % 2 == 0){
            even++;
            if(a[x][y] > 0)plus++;
            else nega++;
        }
        else if(a[x][y] % 2 != 0){
            odd++;
            if(a[x][y] > 0)plus++;
            else nega++;
        }
}
cout << plus << ' ' << nega << ' ' << even << ' ' << odd;   
}