Submission

Status:

PPPPPP-PPP

Subtask/Task Score:

90/100

Score: 90

User: spammer_destroyer

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

Language: cpp

Time: 0.009 second

Submitted On: 2025-10-12 16:57:38

//c1_su63_arrayexp2
//ระวัง error เพราะเช็คcaseไม่ครบแม้โจทย์การันตี
#include <iostream>
using namespace std;
int main() {
  int n,m,i,j,positive=0,negative=0,even=0,odd=0;
  cin >> n >> m;
  int arr[n][m];
  for(i=0;i<n;i++) {
    for(j=0;j<m;j++) {
      cin >> arr[i][j];
    }
  }
  int k;
  cin >> k;
  int x=0,y=0,should=0,last_x,last_y;
  for(i=0;i<k;i++) {
    cin >> x >> y;
    if(x==0&&y==0&&should==0) {
      continue;
    }
    should=1;
    if(x<1||x>n||y<1||y>m) {
      x=last_x;
      y=last_y;
    }
    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++;}
    last_x=x;
    last_y=y;
  }
  cout<<positive<<" "<<negative<<" "<<even<<" "<<odd;
  
  return 0;
}