[C++] 프로그래머스 프린터 스택/큐
·
Algorithm/Programmers
#include #include #include using namespace std; int solution(vector priorities, int location) { int answer = 0; priority_queue pq; queue q; for(int i = 0; i < priorities.size(); i++) { pq.push({priorities[i], i}); q.push({priorities[i], i}); } while(!pq.empty()) { int currVal = q.front().first; int currNum = q.front().second; //제일 값이 높은 것과 현재 것이 같다, 현재 번호와 location이랑 같아야 된다. if(pq.top().first ==..