Horje
priority queue c++ type of pairs Code Example
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;
}




Cpp

Related
cpp map iterate over keys Code Example cpp map iterate over keys Code Example
error: implicit declaration of function 'kill' is invalid in C99 Code Example error: implicit declaration of function 'kill' is invalid in C99 Code Example
cannot jump from switch statement to this case label c++ Code Example cannot jump from switch statement to this case label c++ Code Example
case label in c++ Code Example case label in c++ Code Example
Resize method in c++ for arrays Code Example Resize method in c++ for arrays Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10