Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Zailagend1

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-06-19 20:56:22

#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define pb push_back
#define all(v) v.begin(), v.end()
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int pos = 0;
    int neg = 0;
    int even = 0;
    int odd = 0;
    int t;
    int q;
    cin >> t >> q; 
    std::vector<std::vector<int>> a(t, std::vector<int>(q, 0));
    for(int i = 0;i<t;i++){
      for(int j = 0;j<q;j++){
        cin >> a[i][j];
      }
    }
    int r;
    cin >> r;
    std::vector<std::vector<int>> b(r, std::vector<int>(2, 0));
    for(int i = 0;i<r;i++){
      for(int j = 0;j<2;j++){
         cin >> b[i][j];
     
      }
    }
    for(int i = 0;i<r;i++){
      if(b[i][0] > t || b[i][1] > q || b[i][0] < 1 || b[i][1] < 1){continue;}
      if(a[(b[i][0])-1][(b[i][1])-1] % 2 == 0){even++;}else{odd++;}
      if(a[(b[i][0])-1][(b[i][1])-1] > 0){pos++;}else{if(a[(b[i][0])-1][(b[i][1])-1] != 0){neg++;}}
    }
    cout << pos << " " << neg << " " << even << " " << odd;
    return 0;
}