Submission
Status:
PPPPPP-PPP
Subtask/Task Score:
90/100
Score: 90
User: FIrmTInn
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.009 second
Submitted On: 2025-10-12 01:20:03
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, m, find_num, x, y;
long long c_pos = 0, c_neg = 0, c_even = 0, c_odd = 0;
int last_val = 0;
cin >> n >> m;
int arr1[n][m];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> arr1[i][j];
}
}
cin >> find_num;
for(int i = 0; i < find_num; i++){
cin >> x >> y;
int current_val;
if(x >= 1 && x <= n && y >= 1 && y <= m){
current_val = arr1[x-1][y-1];
last_val = current_val;
} else {
current_val = last_val;
}
if(current_val % 2 == 0){
c_even++;
}
else {
c_odd++;
}
if(current_val > 0){
c_pos++;
}
else if(current_val < 0){
c_neg++;
}
}
cout << c_pos << " " << c_neg << " " << c_even << " " << c_odd << "\n";
return 0;
}