0分RE
查看原帖
0分RE
1269138
Lisbourg楼主2024/10/14 17:25
#include<bits/stdc++.h>
#define int long long
using namespace std;
struct st{
	int jtfs;
	int jg;
	int sj;
}a[100005];
struct yh{
	int time;
	int jg;
}yhp[100005];
int check(int i,int t){
	for(int j=min(t-46,1LL);j<=t;j++){
		if(a[i].sj-yhp[t].time>45) return -1;
		else if(a[i].sj-yhp[j].time<=45&&a[i].jg<=yhp[j].jg) return j;
	}
	return -1;
}
signed main(){
//	ifstream cin("in");
//	ofstream cout("out");
	int n;
	cin>>n;
	int sum=0;
	for(int i=1,t=0;i<=n;i++){
		cin>>a[i].jtfs>>a[i].jg>>a[i].sj;
		if(a[i].jtfs==0){
			yhp[++t].time=a[i].sj;
			yhp[t].jg=a[i].jg;
			sum+=a[i].jg;
			continue;
		}
		int check_return=check(i,t);
		if(a[i].jtfs==1&&t!=0&&check_return!=-1){
			yhp[check_return].time=yhp[check_return].jg=0;
		}
		else{
			sum+=a[i].jg;
		}
	}
	cout<<sum;
}

RE 0分 在本地测试样例1为36,到洛谷上就变成了30

2024/10/14 17:25
加载中...