This topic allows me to understand the specific function overload of the priority queue. <it is used to indicate the priority
# Include <stdio. h> # include <math. h> # include <queue> # include <algorithm> # include <iostream> # include <string. h> using namespace STD; struct node {int Pi, mi; bool operator <(const node A) const {return pI <. pi; // indicates that the highest priority is top }}; int main () {int V; while (~ Scanf ("% d", & V) {priority_queue <node, vector <node>, less <node> q; int N; scanf ("% d", & N); While (n --) {int Pi, mi; node no; scanf ("% d", & Pi, & mi); No. pi = PI; No. mi = mi; q. push (NO);} int ans = 0; while (! Q. empty () & V) {If (Q. top (). mi <= V) {ans + = Q. top (). mi * q. top (). pi; V-= Q. top (). mi; node no; NO = Q. top (); q. pop ();} else {ans + = V * q. top (). pi; V = 0 ;}} printf ("% d \ n", ANS) ;}return 0 ;}