[[TableOfContents]] = 오늘의 문제 = * [https://www.acmicpc.net/problem/1480|보석 도둑] = 참가자 = = 코드 = == 15이원준 == {{{ #include #include #include #include #include using namespace std; class PairCompare { public: bool operator()(pair &p1, pair &p2){ if(p1.first == p2.first){ return p1.second < p2.second; } else{ return p1.first < p2.first; } } }; int main(){ priority_queue, vector>, PairCompare> que; multiset bag; int N, K; long long int ans = 0; cin >> N >> K; for(int i = 0; i tmp = que.top(); que.pop(); auto p = bag.lower_bound(tmp.second); if(p != bag.end()){ ans+= tmp.first; bag.erase(p); } } cout<< ans<