WA,求调
查看原帖
WA,求调
1151812
CZY880201楼主2024/10/22 21:57
#include <bits/stdc++.h>
using namespace std;
struct tran
{
	int ftime;//jie shu shi jian
	int prime;//jia zhi
	bool used;//neng bu neng yong
}a[100010];
int headpos;
int tailpos;//wei zuo biao
int main()
{
	int n;
	cin >>n;
	int ans=0;
	for(int i = 1;i <= n;i++)
	{
		int ub,coin,time;
		cin >>ub>>coin>>time;
		if(!ub)//underground
		{
			ans+=coin;
			a[tailpos].ftime=time+45;
			a[tailpos].prime=coin;
			a[tailpos].used=0;
			tailpos++;	
		}
		else
		{
			while(headpos<=tailpos&&a[headpos].ftime<=time)
			{
				headpos++;
			}
			bool ist=0;
			for(int j = headpos;j <= tailpos;j++)
			{
				if(a[j].prime>=coin&&a[j].used==0)
				{
					a[j].used=1;
					ist=1;
				}
			}
			if(!ist)
			{
				ans+=coin;
			}
		}
	}
	cout <<ans;
	return 0;
} 

万能的神犇,帮我看看

2024/10/22 21:57
加载中...