Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: 666whynot
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.005 second
Submitted On: 2025-09-03 20:00:01
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);cin.tie(0);
int r,c;cin>>r>>c;
int a[r][c];
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin >> a[i][j];
}
}
int plus=0,nega=0,even=0,odd=0;
int k;cin>>k;
while(k--){
int x,y;cin>>x>>y;
x--;y--;
if(x < 0 || y < 0 || x >= r || y >= c)continue;
if(a[x][y] % 2 == 0){
even++;
if(a[x][y] > 0)plus++;
else if(a[x][y] < 0 )nega++;
}
else if(a[x][y] % 2 != 0){
odd++;
if(a[x][y] > 0)plus++;
else if(a[x][y] < 0 )nega++;
}
}
cout << plus << ' ' << nega << ' ' << even << ' ' << odd;
}