0分求调!
查看原帖
0分求调!
1010145
gejiaqia楼主2024/8/20 20:45

rt 样例也不对

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
struct res{
	int t,p;//p时间,t具体值 
	bool vis;
};
res th[N];
int n;
int main(){
	cin>>n;
	int res=0;
	for(int i=0,l=0,r=0;i<n;i++){
		int a,b,c;
		cin>>a>>b>>c;
		if(a==0){
			res+=b;
			th[i].p=c;
			th[i].t=b;
		}else{
			while(l<r&&c-th[l].p>45){
				l++;
			}
			bool us=false;
			for(int j=l;j<r;j++){
				if(th[j].vis==false&&th[j].t>=b){
					th[j].vis=true;
					us=true;
					break;
				}
			}
			if(us==false){
				res+=b;
			}
		}
	}
	cout<<res;
	return 0;
}
2024/8/20 20:45
加载中...