模板,最后挣扎一下
我不想退役,一定要拿省一 奥利给 1. 堆 #include<bits/stdc++.h> using namespace std; #define rint register int int n; priority_queue< int, vector< int >, greater< int > > que; inline int read( void ){ int re = 0, f = 1; char ch = getchar(); while( ch > '9' || ch < '0' ){ if( ch == '-' ) f = -1; ch = getchar(); } while( ch >= '0' && ch <= '9' ){ re = re * 10 + ch - '0'; ch = getchar(); } return re * f; } int main( void ){ n = read(); for( rint i = 1; i <= n; i++ ){ int temp; temp = read(); if( temp == 1 ) que.push( read() ); if( temp == 2 ) printf( "%d\n", que.top() ); if( temp == 3 ) que.pop(); } return 0; }