Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: ssens3
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.011 second
Submitted On: 2026-10-04 08:57:50
#include <iostream>
#include <vector>
using namespace std;
int main(){
int r, c, n, x, y, e[4] = {0}; cin >> r >> c;
vector<vector<int>> v(r+1, vector<int>(c+1));
for (int i = 1; i <= r; i++){
for (int j = 1; j <= c; j++){
cin >> v[i][j];
}
}
cin >> n;
for (int i = 0; i < n; i++){
cin >> x >> y;
if (x > r || x <= 0 || y > c || y <= 0) continue;
if (v[x][y] > 0) e[0]++;
else if (v[x][y] < 0) e[1]++;
if (v[x][y] % 2 == 0) e[2]++;
else e[3]++;
}
for (int i = 0; i < 4; i++){
cout << e[i] << " ";
}
}