[C++] 프로그래머스 게임 맵 최단거리


[C++] 프로그래머스 게임 맵 최단거리

문제 소스 코드 #include <vector> #include <queue> #define max(a,b) ((a) > (b) ? (a) : (b)) #define min(a,b) ((a) > (b) ? (b) : (a)) #define pr pair<int,int> #define x first #define y second using namespace std; int n,m; int solution(vector<vector<int> > maps) { queue<pr> q; q.push({0,0}); m = maps.size()-1; n = maps[0].size()-1; int **dp = new int*[m+1]; for(int i=0;i<m+1;i++) dp[i] = new int[n+1]; dp[0][0] = 1; maps[0][0] = 0; while(q.size()>0) { pr pos = q.front(); if(pos.x == m && pos.y == n) retur...



원문링크 : [C++] 프로그래머스 게임 맵 최단거리