Search
 
SCRIPT & CODE EXAMPLE
 

CPP

priority queue c++ type of pairs

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
// main program
int main() {
   priority_queue<pi, vector<pi>, greater<pi> > pq;
   pq.push(make_pair(10, 200));
   pq.push(make_pair(20, 100));
   pq.push(make_pair(15, 400));
   pair<int, int> top = pq.top();
   cout << top.first << " " << top.second;
   return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: cpp goiver all the map values 
Cpp :: sfml mouse button pressed 
Cpp :: how to loop a 2 dimensional vector in c++ starting from second element 
Cpp :: c++ main function 
Cpp :: initialize 2d array c++ memset 
Cpp :: 2d array using vector 
Cpp :: all of the stars lyrics 
Cpp :: how to declare 1-D array in C/C++ 
Cpp :: c++ unordered_map check if key exists 
Cpp :: how to run a c++ program in the background 
Cpp :: apply pca to dataframe 
Cpp :: queue implementation using linked list in cpp 
Cpp :: how to check if a value is inside an array in c++ 
Cpp :: c++ program to take input from user 
Cpp :: difference between lower and upper bound 
Cpp :: cases in cpp 
Cpp :: pbds in c++ 
Cpp :: c++ string to int conversion 
Cpp :: sort vector using marge sorting in c++ 
Cpp :: do while loop c++ loops continuously 
Cpp :: Resize method in c++ for arrays 
Cpp :: sieve of eratosthenes algorithm in c++ 
Cpp :: cpp insert overload operator 
Cpp :: matrix transpose in c++ 
Cpp :: C++ break and continue 
Cpp :: create a 2d vector in c++ 
Cpp :: Count Prefix of a Given String solution leetcode 
Cpp :: how to code string to int converter c++ 
Cpp :: cpp string slice 
Cpp :: Reverse Level Order Traversal cpp 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =