Submission

Status:

PPPPPPxPPP

Subtask/Task Score:

90/100

Score: 90

User: spammer_destroyer

Problemset: สำรวจอาเรย์ 2

Language: cpp

Time: 0.009 second

Submitted On: 2025-10-12 12:56:03

//c1_su63_arrayexp2
//ระวัง error เพราะเช็คcaseไม่ครบแม้โจทย์การันตี
#include <iostream>
using namespace std;

int main() 
{
    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;
}