Submission
Status:
PPPPPP-PPP
Subtask/Task Score:
90/100
Score: 90
User: PROb221
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.009 second
Submitted On: 2025-10-09 22:33:39
//c1_su63_arrayexp2
#include <iostream>
using namespace std;
int main() {
int n,m,i,j,h,x,y,xlock=0,ylock=0,ne=0,p=0,e=0,o=0;
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)&&(xlock==0&&ylock==0)) {
// continue;
// }
/*else*/ if(x<1||x>n||y<1||y>m) {
x=xlock;y=ylock;
}
if(arr[x-1][y-1]<0)ne++;
if(arr[x-1][y-1]>0)p++;
if(arr[x-1][y-1]%2==0)e++;
if(arr[x-1][y-1]%2!=0)o++;
xlock=x;ylock=y;
}
cout << p << " " << ne << " " << e << " " << o;
return 0;
}