求助,满江红
查看原帖
求助,满江红
1051283
SCP_BOSS楼主2024/8/15 10:18
#include<bits/stdc++.h>
using namespace std;
struct piao{
	int jiage,shijian;
};
deque<piao>q;
int lx,jg,sj,money,n;
int main()
{
	cin>>n;
	while(n--)
	{
		cin>>lx>>jg>>sj;
		money+=jg;
		if(lx==0)
		{
			piao x;
			x.jiage=jg;
			x.shijian=sj;
			q.push_back(x);
		}
		else
		{
			while(q.size()>0 && sj-q.front().shijian>45)
			{
				q.pop_front();
			}
			for(int i=1;i<=q.size();i++)
			{
				if(q[i].jiage>=jg )
				{
					money-=jg;
					q[i].shijian=-1;
					break;
				}
			}
		}
	}
	cout<<money;
	return 0;
}

2024/8/15 10:18
加载中...