思路:直接暴力怒艹...别多想
#include<bits/stdc++.h>
using namespace std;
#define LL long long
//list<pair<LL,LL> >li;
int main()
{
int n;
while (scanf("%d",&n)!=EOF&&n)
{
list<pair<LL,LL> >li;
LL op,a,b;
for (int i = 0;i<n;i++)
{
scanf("%lld%lld%lld",&op,&a,&b);
if (op==1)
li.push_front(pair<LL,LL>(a,b));
else if (op==-1)
{
pair<LL,LL> temp = pair<LL,LL>(a,b);
for (list<pair<LL,LL> >::iterator it = li.begin();it!=li.end();it++)
{
if (*it==temp)
{
li.erase(it);
break;
}
}
}
else
{
LL maxn = 0,flag=1;
for (list<pair<LL,LL> >::iterator it = li.begin();it!=li.end();it++)
{
if (flag)
maxn = it->first*a+it->second*b,flag=0;
else
maxn = max(maxn,it->first*a+it->second*b);
}
printf("%lld\n",maxn);
}
}
}
}