링크 : https://school.programmers.co.kr/learn/courses/30/lessons/42626
#include <string>
#include <vector>
#include <queue>
using namespace std;
int solution(vector<int> scoville, int K) {
int answer = 0;
priority_queue<int, vector<int>, greater<int>> pq;
for(int i = 0; i < scoville.size(); i++){
pq.push(scoville[i]);
}
while(pq.top() < K){
if(pq.size() == 1){
return -1;
}
int last = pq.top();
pq.pop();
int last_second = pq.top();
pq.pop();
int temp = last + (last_second * 2);
pq.push(temp);
answer ++;
}
return answer;
}