在p3378中提交这两代码:
#include<bits/stdc++.h>
using namespace std;
multiset<int>s;
int n;
signed main()
{
cin>>n;
while(n--)
{
int a,b;cin>>a;
if(a==1)
{
cin>>b;s.insert(b);
}
if(a==2)
{
cout<<*s.begin()<<endl;
}
if(a==3)
{
s.erase(s.begin());//注意这一行
}
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
multiset<int>s;
int n;
signed main()
{
cin>>n;
while(n--)
{
int a,b;cin>>a;
if(a==1)
{
cin>>b;s.insert(b);
}
if(a==2)
{
cout<<*s.begin()<<endl;
}
if(a==3)
{
s.erase(*s.begin());
}
}
return 0;
}
代码一AC, 代码二44pts 好神奇