Submission
Status:
PPPPPP-PPP
Subtask/Task Score:
90/100
Score: 90
User: chillxvtkz
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.005 second
Submitted On: 2026-10-09 09:34:49
#include <bits/stdc++.h>
#define ll long long
#define ct cout << ' '
#define el cout << endl;
using namespace std;
const int mx = 1e9;
const int mn = -1e9;
ll arr[305][305],R,C,t,ch,x,y,bb=0,rr=0,eve=0,od=0,w,d;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> R >> C;
for (int i = 1; i <= R; i++)
{
for (int j = 1; j <= C; j++)
{
cin >> t;
arr[i][j] = t;
}
}
cin >> ch;
for (int i = 0; i < ch; i++)
{
cin >> w >> d;
if(w<=R && w>=1 && d<=C && d>=1){
x = w;y = d;
}
if(arr[x][y]>0) bb=bb+1;
if(arr[x][y]<0) rr=rr+1;
if(arr[x][y]%2==0) eve=eve+1;
if(arr[x][y]%2!=0) od=od+1;
}
cout << bb << " " << rr << " " << eve << " " << od << "\n";
return 0;
}