Submission

Status:

PPPPPP-PPP

Subtask/Task Score:

90/100

Score: 90

User: kenkong587

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

Language: c

Time: 0.005 second

Submitted On: 2026-10-13 20:02:23

#include <stdio.h>

int main(){

    int w,l;

    scanf("%d %d",&w,&l);

    int array[w][l];

    for(int i = 0;i < w;i++){
        for(int j = 0;j < l;j++){
            scanf("%d",&array[i][j]);
        }
    }

    int plus = 0;
    int minus = 0;
    int even = 0;
    int odd = 0;

    int n;

    scanf("%d",&n);

    int a;
    int b;
    int numbefore = 0;

    for(int i = 0;i < n;i++){
        int num;

        scanf("%d %d",&a,&b);

        if(a >= 1 && a <= w && b >= 1 && b <= l){
            num = array[a-1][b-1];
            numbefore = num;
        }
        else{
            num = numbefore;
        }

        if(num > 0){
            plus++;
        }
        if(num < 0){
            minus++;
        }
        if(num % 2 == 0){
            even++;
        }
        else{
            odd++;
        }
    }

    printf("%d %d %d %d",plus,minus,even,odd);

    return 0;
}