全wa求助,悬赏一关
查看原帖
全wa求助,悬赏一关
920514
LHY20221231楼主2024/4/11 17:01

样例永远只过一个

#include<bits/stdc++.h>
using namespace std;
int n,g[10001],q[10001],s[10001],yhj[10001],hf,sum;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>g[i]>>q[i]>>s[i];
	}
	//hf+=q[1];
	for(int i=1;i<=n;i++){
		if(g[i]==1){
			for(int j=1;j<=i;j++){
				if(yhj[j]==1&&q[j]>=q[i]&&s[i]-s[j]<=45){
					sum=1;
					yhj[j]=0;
				}
			}
			if(sum!=1){
				hf+=q[i];
				sum=0;
			}
			else{
				sum=0;
			}
			
		}
		else{
			hf+=q[i];
			//for(int j=1;j<=i;j++)
			yhj[i]=1;
		}
	}
	cout<<hf;
	return 0;
}
2024/4/11 17:01
加载中...