Submission
Status:
PPPPPPxPPP
Subtask/Task Score:
90/100
Score: 90
User: ohoho
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.006 second
Submitted On: 2025-10-09 22:07:17
//c1_su63_arrayexp2
#include <iostream>
#include <vector>
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=0,y=0,xlock,ylock;
cin >> n >> m;
vector<vector<int>> arr(310, vector<int>(310));
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!=0) {
odd++;
}
xlock=x;
ylock=y;
}
cout << positive << " " << negative << " " << even << " " << odd;
return 0;
}