Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: angpangSK
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.009 second
Submitted On: 2025-09-24 09:05:14
#include <iostream>
#include <cmath>
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 k;
cin >> k;
int check[k][2];
for(int i=0;i<k;i++){
int x;
cin >> x;
int y;
cin >> y;
check[i][0] = x-1;
check[i][1] = y-1;
}
int negative = 0;
int positive = 0;
int even = 0;
int odd = 0;
for (int i = 0; i < k; i++) {
int x = check[i][0];
int y = check[i][1];
if (x >= r || y >= c || x < 0 || y < 0) {
continue;
}
if (arr[x][y] < 0)
negative++;
else if (arr[x][y] > 0)
positive++;
if (arr[x][y] % 2 == 0)
even++;
else
odd++;
}
cout << positive << " " << negative << " " << even << " " << odd;
return 0;
}