Why don't AC solutions consider cost state in distance calculation ?
\n Describe your first thoughts on how to solve this problem. \nAll of them use djisktra to normalise weight with the condition\nAssuming dist[i][j] -> Minimum 
\n<!-- Describe your first thoughts on how to solve this problem. -->\nAll of them use djisktra to normalise weight with the condition\nAssuming dist[i][j] -> Minimum time to reach (i,j)\nAnd we insert into PQ (Min Heap) as (minArrivalTime, nextStepCost, nextRow, nextCol)\nAlso assume matrix[n-1][m-1] = 0 (To simply say it has no restriction)\nConsider a m*n matrix\n\nSuppose I reach a state where I calculate dist[n-1][m-2] = 10, and I reached to this state with a cost of moving as 1, hence to move to (n-1,m-1) the cost would be 2, so when this tuple will be popped and evaluated dist[n-1][m-1] will be set as 12(10+2).And we will push the state (10,2,n-1,m-2) to pq.\n\nHowever there might be case where through some alternate route later in the algorithm we reach (n-1,m-2) with a distance of 10 again but this time I reach with a cost of 2, so to move to n-1,m-1 the cost will be 1, and total distance will be 10 + 1. But if we check normalisation process it will check if\n\ndist[n-1][m-2] > currArrivalTime (but since they are equal this would fail)\nand we would never push the state (10,1,n-1,m-2) on the pq.\n\nAnd since the state wouldn\'t be evaluated the answer might be wrong.\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int minTimeToReach(vector<vector<int>>& vec) {\n        int n = vec.size();\n        int m = vec[0].size();\n\n        priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> pq;\n        vector<vector<int>> dist(n, vector<int>(m, INT_MAX));\n        vector<int> dirx = {1, 0, -1, 0};\n        vector<int> diry = {0, 1, 0, -1};\n\n        pq.push({0, 1, 0, 0});\n\n        dist[0][0] = 0;\n        int x,y,time,cost,nx, ny;\n\n        while (!pq.empty()) {\n            auto p = pq.top();\n            pq.pop();\n            x = p[2];\n            y = p[3];\n            time = p[0];\n            cost = p[1];\n\n            for (int i = 0; i < 4; i++) {\n                nx = x + dirx[i];\n                ny = y + diry[i];\n\n                if (isValid(nx, ny, n, m)) {\n                    int ntime;\n                    if (vec[nx][ny] >= time) {\n                        ntime = vec[nx][ny] + cost;\n                    } else {\n                        ntime = time + cost;\n                    }\n\n                    if (dist[nx][ny] > ntime) {\n                        dist[nx][ny] = ntime;\n                        pq.push({ntime, cost == 1 ? 2 : 1, nx, ny});\n                    }\n                }\n            }\n        }\n            return dist[n-1][m-1];\n        }\n\n        bool isValid(int x, int y, int r, int c) {\n            if (x < 0 || y < 0 || x >= r || y >= c)\n                return false;\n            return true;\n        }\n    };\n```
['C++']