Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: ztmy_
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.010 second
Submitted On: 2025-10-12 16:40:09
#include <iostream>
using namespace std;
int main(){
int r, c;
int plus = 0, minus = 0, even = 0, odd = 0;
cin >> r >> c;
int arr[r+1][c+1] = {0};
for (int i = 1; i <= r; i++){
for (int j = 1; j <= c; j++){
cin >> arr[i][j];
}
}
int k;
cin >> k;
for (int i = 1; i <= k; i++){
int x, y;
cin >> x >> y;
if (x > 0 && x <= r && y > 0 && y <= c){
if (arr[x][y] % 2 == 0) even++;
if (arr[x][y] % 2 != 0) odd++;
if (arr[x][y] > 0) plus++;
if (arr[x][y] < 0) minus++;
}
}
cout << plus << " " << minus << " " << even << " " << odd;
}