1 条题解

  • 0
    @ 2023-3-13 11:51:14

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
    	ios::sync_with_stdio(false);
    	priority_queue<int,vector<int>,greater<int> > q;
    	int n,k;
    	char a;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		cin>>a;
    		if(a=='i')
    		{
    			cin>>k;
    			q.push(k);
    		}
    		if(a=='q')
    		{
    			cout<<q.top() <<endl;
    			q.pop() ;
    		}
    	}
    	return 0;
    }
    
    
    • 1

    信息

    ID
    1809
    时间
    1000ms
    内存
    16MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者