Submission
Status:
PPPPPP-PPP
Subtask/Task Score:
90/100
Score: 90
User: chs_14
Problemset: สำรวจอาเรย์ 2
Language: cpp
Time: 0.009 second
Submitted On: 2026-01-18 14:21:34
#include <bits/stdc++.h>
using namespace std;
vector<int> output(4);
void check(int n) {
if (n<0) {
++output[1];
}
else if (n>0) {
++output[0];
}
if (n%2) {
++output[3];
}
else {
++output[2];
}
}
int main() {
cin.tie(0)->sync_with_stdio();
int R, C, K;
cin >> R >> C;
vector<vector<int>> table(R, vector<int>(C, 0));
for (int i = 0; i < R; i++)
{
for (int j = 0; j < C; j++)
{
cin >> table[i][j];
}
}
cin >> K;
int x, y, prev_n;
for (int i = 0; i < K; i++)
{
cin >> x >> y;
--x; --y;
if (x>=0 && x < R && y >= 0 && y < C) {
check(table[x][y]);
prev_n = table[x][y];
}
else {
check(prev_n);
}
}
for (int &x : output)
{
cout << x << ' ';
}
return 0;
}