Submission

Status:

PP---P--P-

Subtask/Task Score:

40/100

Score: 40

User: 666whynot

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

Language: cpp

Time: 0.005 second

Submitted On: 2025-09-03 16:42:31

#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=0;i<r;i++){
        for(int j=0;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;
        x--;y--;
        if(x < 0 || y < 0 || x > r || y > c)continue;
        else 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;   
}