분류 전체보기144 [프로그래머스] 구현 - 340211번 충돌위험 찾기 #include #define fastio cin.tie(0)->sync_with_stdio(0)using namespace std;const int MAX = 101;// 운송 포인트, 운송 경로int solution(vector> points, vector> routes) { int answer=0; int numRobots = routes.size(); vector> pointCoords(points.size()+1); // 특정 위치 for(int i=0; i pointCoords[i+1] = (x, y)로 저장 } vector>> robotPaths(numRobots); //robotPaths[i]는 i번 로봇이 이동한 좌표들 int maxTi.. 2025. 5. 25. [프로그래머스] BFS - 388353번 지게차와 크레인 #include #define fastio cin.tie(0)->sync_with_stdio(0)using namespace std;bool visited[51][51];void gCar(char target, vector &storage, int n, int m){ int dx[4]={-1,1,0,0}; int dy[4]={0,0,1,-1}; vector> delPoint; //초기화 for(int idx=0; idx> q; q.push(make_pair(i,j)); visited[i][j]=true; while(!q.empty()){ //인접한 target 검색 .. 2025. 5. 25. [백준] 13459번 구슬 탈출 #include #define fastio cin.tie(0)->sync_with_stdio(0)using namespace std;struct step{ int Rx, Ry; int Bx, By; int Count;};char mapp[11][11];bool visited[11][11][11][11];int N,M;int dx[]={1,-1,0,0}; // 아래, 위, 오, 왼int dy[]={0,0,1,-1};void move(int& rx, int& ry, int& distance, int& i){ while(mapp[rx+dx[i]][ry+dy[i]] !='#' && mapp[rx][ry] !='O') { rx+=dx[i]; ry+=dy[i]; .. 2025. 5. 22. [프로그래머스] 광고 삽입 - sliding window #include #define fastio cin.tie(0)->sync_with_stdio(0)using namespace std;int arr[360010]; // 최대 재생 시간int time_to_sec(string time){ int h=stoi(time.substr(0,2)); //인덱스 0부터 2글자 뗴오기 int m=stoi(time.substr(3,2)); int s=stoi(time.substr(6,2)); return 3600*h+60*m+s;}string time_tostring(int t){ string ret=""; int h=t/3600; t%=3600; int m=t/60; int s=t%60; ret += h>=10 ?.. 2025. 4. 27. 이전 1 2 3 4 ··· 36 다음