Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define inf 99999999
- struct lazy {
- long long value;
- int time;
- lazy(long long val, int tm) {
- value = val;
- time = tm;
- }
- bool operator<(const lazy& rhs) const{
- if(time>rhs.time) return true;
- return false;
- }
- };
- int main(){
- //For struct type priority queue:
- priority_queue<lazy> pq;
- pq.push(lazy(3,76));
- pq.push(lazy(9,9));
- pq.push(lazy(3,7));
- pq.push(lazy(2,1));
- pq.push(lazy(3,65));
- pq.push(lazy(5,71));
- while(pq.empty() == false){
- lazy cur = pq.top();
- pq.pop();
- printf("Time: %d\n",cur.time);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment