请问大佬们?
查看原帖
请问大佬们?
1487960
封禁用户楼主2025/1/25 14:28
#include<bits/stdc++.h>
const int slen=1e5+10;
using namespace std;
struct info{
	int pr;
	int time;
	int flag;
};
info ticket[slen];
int cnt=0,p=0;
bool youhui(int tim,int pri)
{
	for(int o=1;o<=cnt;o++)
	{
		if(tim-ticket[o].time>45) p++;
		if(tim-ticket[o].time<=45 && ticket[o].pr-pri>=0 && ticket[o].flag==0)
		{
			ticket[o].flag=1;
			return 1;
		}	
	}
	return 0;
} 
int main()
{
	int n,sum=0;
	cin>>n;
	for(int o=1;o<=n;o++)
	{
		bool op=0;
		int price=0,t=0;
		cin>>op>>price>>t;
		if(op==0)
		{
			sum+=price;
			ticket[++cnt].flag=0;	ticket[cnt].pr=price;	ticket[cnt].time=t;
		}
		if(op==1)
			if(youhui(t,price)==0)
				sum+=price;
	}
	cout<<sum;
	return 0;
}

请问大佬: 第15行:没有o=p,相当于p是一个摆设,为什么洛谷赏我一个AC???

2025/1/25 14:28
加载中...