떨어지지 않은 주식 가격 #include #include #include using namespace std; vector solution(vector prices) { vector answer(prices.size()); stack s; // 가격 안떨어지는 한 계속 push됨 for(int i=0; i prices[i]) { // 가격 떨어진 거 answer[s.top().first] = i - s.top().first; s.pop(); } else break; } s.push(make_pair(i, prices[i])); } while(!s.empty()) { answer[s.top().first] = (prices.size()-1) - s.top().first; s.pop(); } return a..