玄关
查看原帖
玄关
685824
shenyixuan123楼主2023/9/23 21:18

rt 三个点哇了,为什么呀

#include<bits/stdc++.h>
using namespace std;
struct Node1{
	int fangshi;
	int price;
	int time;
}a[100009];
struct Node2{
	int price1;
	int time1;
}
b[100001];
int x=0;
int main()
{
    //freopen("transfer.in","r",stdin);
	//freopen("transfer.out","w",stdout);
	int n,ans=0,youhui=0,t;
	cin>>n;	
	cin>>a[1].fangshi>>a[1].price>>a[1].time;
	if(a[1].fangshi==0) 
	{
		x++;
		b[x].time1=a[1].time;
		b[x].price1=a[1].price;
	    ans+=a[1].price;
	}
	int o=1;
	for(int i=2;i<=n;i++)
	{
		cin>>a[i].fangshi>>a[i].price>>a[i].time;
		if(a[i].fangshi==1&&x>=1)
		{
			bool pd=false;
			for(int j=o;j<=x;j++)
			{
				if(a[i].time-b[j].time1<=45&&a[i].price<=b[j].price1)
				{
					b[j].price1=b[j].time1=0;
					pd=true;
					o++;
					break;
				}
			}
			if(pd==false) ans+=a[i].price;
		}
		if(a[i].fangshi==0)
		{
			ans+=a[i].price;
			x++;
			b[x].time1=a[i].time;
			b[x].price1=a[i].price;
		}
	}
	cout<<ans;
	return 0;
}
2023/9/23 21:18
加载中...