Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: ChanakanStudy
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.006 second
Submitted On: 2026-10-09 19:05:28
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
using namespace std;
using ll = long long;
int a[301][301];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,m;
cin >> n >> m;
for(int i = 0;i<n;i++) {
for(int j = 0;j<m;j++) {
int temp;
cin >> temp;
a[i][j] = temp;
}
}
int countplus = 0,countera = 0,counteven=0,countodd=0 , rememberx = -1 , remembery = -1;
int q;
cin >> q;
while(q--) {
int x,y;
cin >> x >> y;
if(x >= 1 && x<= n && y >= 1 && y <= m) {
rememberx = x-1;
remembery = y-1;
}
if (rememberx == -1) continue;
if(a[rememberx][remembery] > 0) {
countplus++;
}
if(a[rememberx][remembery]< 0) {
countera++;
}
if(a[rememberx][remembery] %2 == 0) {
counteven++;
}
else {
countodd++;
}
}
cout << countplus << " " << countera << " " << counteven << " " << countodd;
return 0;
}