#include using namespace std;  void solve(long long int r, long long int c,           vector& grid){    priority_queue        pq;      for (long long int i = 0; i < r; i++) {        for (long long int j = 0; j < c; j++) {            pq.push(make_pair(grid[i][j],                              make_pair(i, j)));        }    }      long long int res = 0;      while (!pq.empty()) {        long long int height = pq.top().first,                      i = pq.top().second.first,                      j = pq.top().second.second;        pq.pop();        if (height != grid[i][j])            continue;        if […]

Continue Reading