爆0 WA+TLE
查看原帖
爆0 WA+TLE
578004
02Ljh楼主2022/3/8 22:00

麻烦大佬来看看

#include <bits/stdc++.h>
#define ll long long	
using namespace std;
struct s
{
	int tim;
	int num;
	int mo;
	bool flag=true;
};
s l[100001];
inline int read()
{
	int x=0;
	bool flag=1;
	char c=getchar();
	while(c<'0'||c>'9')
	{
		if(c=='-')
			flag=0;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return (flag?x:~(x-1));
}
int main()
{
	long long a,n,t,p,kkk=0,ans=0;
	bool nxy=true;
	n=read();
	for(int i=0;i<n;i++)
	{
		l[i].num=0;
		a=read();
		p=read();
		t=read();
		if(a==0)
		{
			//l[i].flag=true; 
			l[i].num=kkk;
			kkk++;
			//cout<<kkk<<endl;
			l[i].tim=t;
			l[i].mo=p;
			ans+=p;
		}
		else if(a==1)
		{
			for(int ii=0;ii<=kkk;ii++)
			{
				if(l[ii].mo>=p&&t-l[ii].tim<=45&&l[ii].flag)
				{
					l[ii].flag=false;
					nxy=false;
					break;
				}
				else continue;
			}
			if(nxy)
			{
				ans+=p;
			}
			nxy=true;
		}
	}
	cout<<ans;
	return 0;
}


2022/3/8 22:00
加载中...