Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: kenkong587
Problemset: สำรวจอาเรย์ 1
Language: c
Time: 0.005 second
Submitted On: 2026-10-12 21:18:19
#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 loop;
scanf("%d",&loop);
int plus = 0;
int minus = 0;
int odd = 0;
int even = 0;
int a,b;
int c = 0;
for(int i = 0;i < loop;i++){
scanf("%d %d",&a,&b);
if(a < 1 || a > w || b < 1 || b > l){
continue;
}
c = array[a-1][b-1];
if(c > 0){
plus++;
}
if(c < 0){
minus++;
}
if(c % 2 == 0){
even++;
}
else{
odd++;
}
}
printf("%d %d %d %d",plus,minus,even,odd);
return 0;
}