C++ 0分 全WA 样例过了,但是真的真的不知道哪个细节没处理好QAQ
查看原帖
C++ 0分 全WA 样例过了,但是真的真的不知道哪个细节没处理好QAQ
764455
HAPPYspider楼主2023/7/30 14:01

rt

/*0.0*/
#include<bits/stdc++.h>
using namespace std;

struct node{
	int price=0,time=0;
}a[100005];

int main(){
	//freopen("P5661_1.in","r",stdin); 
	int arr=1,js=1,ans=0;
	bool flag=false;
	int n;
	cin>>n;
	while(n--){
		bool b;
		int p,t;
		cin>>b>>p>>t;
		if(b){
			bool yes_no=true;
			if(!flag){
				ans+=p;
				continue;
			} 
			for(;arr<js;arr++){
				int t1=a[arr].time,p1=a[arr].price;
				if((t-t1<=45)&&p<=p1){
					//printf("t-t1 : %d , p : %d , p1 : %d , arr : %d \n",t-t1,p,p1,arr);
					yes_no=false;
					break;
				}
			}
			if(yes_no)ans+=p;
		}else{
			flag=true;
			a[js].price=p;
			a[js].time=t;
			js++;
			ans+=p;
		}
	//	cout<<ans<<endl;
	}
	cout<<ans<<endl;
	return 0;
}

2023/7/30 14:01
加载中...