Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: pann
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.010 second
Submitted On: 2026-10-09 00:50:59
#include <iostream>
using namespace std;
int main() {
int r, 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 pos = 0, neg = 0, even = 0, odd = 0;
for (int i = 0; i < n; i++) {
int x, y;
cin >> x >> y;
if (x > r || x < 1 || y > c || y < 1) continue;
x--;
y--;
if (arr[x][y] > 0) pos++;
if (arr[x][y] < 0) neg++;
if (arr[x][y] % 2 == 0)
even++;
else
odd++;
}
cout << pos << " " << neg << " " << even << " " << odd;
return 0;
}