Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: The3e
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.009 second
Submitted On: 2026-09-04 18:38:26
#include <iostream>
using namespace std;
int main() {
int R, C;
cin >> R >> C;
int a[305][305];
for(int i=1;i<=R;i++) {
for(int j=1;j<=C;j++) {
cin >> a[i][j];
}
}
int K;
cin >> K;
int p = 0;
int n = 0;
int e = 0;
int o = 0;
for(int i=0;i<K;i++) {
int r, c;
cin >> r >> c;
if (r >= 1 && r <= R && c >= 1 && c <= C) {
int x = a[r][c];
if(x >0) p++;
if(x <0) n++;
if(x%2==0) e++;
else o++;
}
}
cout << p << " " << n << " " << e << " " << o << endl;
return 0;
}