Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: JRomsponCH
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.009 second
Submitted On: 2025-09-30 14:11:57
#include<bits/stdc++.h>
using namespace std;
int main() {
int r;
int c;
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];
}
}
int n;
cin>>n;
int x;
int y;
int even = 0;
int odd = 0;
int plus = 0;
int neg = 0;
for (int i = 0; i < n; i++) {
cin>>x>>y;
x--,y--;
if ((x >= 0 and y >= 0) and (x < r and y < c)) {
if (arr[x][y] % 2 == 0) {
even += 1;
}
if (abs(arr[x][y]) % 2 == 1) {
odd += 1;
}
if (arr[x][y] > 0) {
plus += 1;
}
if (arr[x][y] < 0) {
neg += 1;
}
}
}
cout<<plus<<" "<<neg<<" "<<even<<" "<<odd;
}