Submission
Status:
Compilation Error
Subtask/Task Score:
Score: 0
User: fillhavertz
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.000 second
Submitted On: 2025-10-13 13:03:46
#include <iostream>
#include <vector>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int r,c;
cin>>r>>c;
vector<vector<int>> table(r,vector<int>(c));
for(int i=0;i<r;i++) for(int j=0;j<c;j++) cin>>table[i][j];
int odd=0,even=0,plus=0,minus=0;
int n;
cin>>n;
bool p,o;
vector<int> x(n),y(n);
for(int i=0;i<n;i++) cin>>x[i]>>y[i];
bool z,c=0;
for (int i = 0; i < n; i++) {
int xx = x[i] - 1;
int yy = y[i] - 1;
if (xx >= 0 && xx < r && yy >= 0 && yy < c) {
int val = table[xx][yy];c=1;
if (val > 0) {plus++; p=1;z=1;}
else if (val < 0) {minus++; p=0;z=1;}
else z=0;
if (val % 2 == 0) {even++; o=0;}
else {odd++; o=1;}
}else if(c){
if(z){
if(p) plus++;
else minus++;
}
if(o) odd++;
else even++;
}
}
cout<<plus<<' '<<minus<<' '<<even<<' '<<odd;
return 0;
}