Submission
Status:
PPPPPPxPPP
Subtask/Task Score:
90/100
Score: 90
User: PROb221
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.005 second
Submitted On: 2025-10-09 21:17:21
//c1_su63_arrayexp2
#include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m,h,i,j,positive=0,negative=0,even=0,odd=0,x,y,xlock,ylock;
cin >> n >> m;
int arr[n][m];
for(i=0;i<n;i++) {
for(j=0;j<m;j++) {
cin >> arr[i][j];
}
}
cin >> h;
for(i=0;i<h;i++) {
cin >> x >> y;
if(x<1||x>n||y<1||y>m) {
x=xlock;y=ylock;
}
if(arr[x-1][y-1]>0) {
positive++;
}
if(arr[x-1][y-1]<0) {
negative++;
}
if(arr[x-1][y-1]%2==0) {
even++;
}
if(arr[x-1][y-1]%2==1||arr[x-1][y-1]%2==-1) {
odd++;
}
xlock=x;
ylock=y;
}
cout << positive << " " << negative << " " << even << " " << odd;
return 0;
}