C++ priority_queue minimal time 
```cpp []
class Solution {
public:
    int minTimeToReach(vector<vector<int>>& moveTime) {
        int m = moveTime.size();
        int n = moveTime[0].size();
        int dir[5]{0,1,0,-1,0};
        vector<vector<bool>> visited(m, vector<bool>(n));
        priority_queue<array<int,4>> pq;
        pq.push({0,0,0,1});
        visited[0][0] = true;
        while(!pq.empty()) {
            auto curr = std::move(pq.top());
            pq.pop();
            if ( curr[1]==m-1 && curr[2] == n-1)
                return -curr[0];
            for(int d = 0; d < 4; ++d)
            {
                int nx = curr[1]+dir[d];
                int ny = curr[2]+dir[d+1];
                if(min(nx, ny) >= 0 && nx < m && ny < n && !visited[nx][ny]) {
                    visited[nx][ny] = true;
                    pq.push({min(curr[0], -moveTime[nx][ny])-curr[3], nx, ny, 3^curr[3]});
                }
            }
        }
        return -1;
    }
};
```
['C++']