Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: rice_ot

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

Language: cpp

Time: 0.005 second

Submitted On: 2025-10-17 11:29:22

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, m, q; cin>>n>>m;
	int grid[n][m];
	for(int i = 0; i<n; i++){
	    for(int j = 0; j<m; j++){
	        cin>>grid[i][j];
	    }
	}
	cin>>q;
	int p = 0, ne = 0, e = 0, o = 0;
	for(int i = 0; i<q; i++){
	    int y, x; cin>>y>>x;
	    y--; x--;
	    if(y >= n || x >= m || x < 0 || y < 0) continue;
	    if(grid[y][x] > 0) p++;
	    else if(grid[y][x] < 0) ne++;
	    if(grid[y][x]%2 == 0) e++;
	    else o++;
	}
	cout<<p<<" "<<ne<<" "<<e<<" "<<o;
}