Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: nate213121
Problemset: สำรวจอาเรย์ 1
Language: cpp
Time: 0.009 second
Submitted On: 2026-09-17 20:15:38
#include <bits/stdc++.h>
using namespace std;
int main()
{
int pos = 0, neg = 0, even = 0, odd = 0;
int rows, columns;
cin >> rows >> columns;
vector<vector<int>> v(rows, vector<int>(columns));
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < columns; j++)
{
cin >> v[i][j];
}
}
int k;
cin >> k;
for(int i = 0; i < k; i++)
{
int r, c;
cin >> r >> c;
r--;
c--;
if(!(r >= 0 && r < rows && c >= 0 && c < columns))
{
continue;
}
int check = v[r][c];
if(check > 0)
{
pos++;
}
if(check < 0)
{
neg++;
}
if(check % 2 == 0)
{
even++;
}
if(check % 2 != 0)
{
odd++;
}
}
cout << pos << " " << neg << " " << even << " " << odd;
}